A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/ko/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll below:

RegExp.prototype.dotAll - JavaScript | MDN

RegExp.prototype.dotAll

Baseline Widely available

dotAll 속성은 s 플래그가 정규식과 함께 사용되는지 여부를 나타냅니다. dotAll은 개별 정규식 인스턴스의 읽기 전용 속성입니다.

시도해 보기
const regex1 = new RegExp("foo", "s");

console.log(regex1.dotAll);
// Expected output: true

const regex2 = new RegExp("bar");

console.log(regex2.dotAll);
// Expected output: false
설명

dotAll의 값은 Boolean으로 s 플래그가 사용된 경우 true, 그렇지 않으면 false입니다. s 플래그는 점 특수 문자(.)가 문자열의 다음 줄 종결자("newline") 문자와 추가로 일치해야 함을 나타냅니다. 그렇지 않으면 일치하지 않습니다.

이것은 사실상 점이 유니코드 BMP(Basic Multilingual Plane)의 모든 문자와 일치한다는 것을 의미합니다. 별 기호와 일치하도록 하려면 u(유니코드) 플래그를 사용해야 합니다. 두 플래그를 함께 사용하면 예외 없이 점이 모든 유니코드 문자와 일치하도록 만들 수 있습니다.

dotAll의 set 접근자는 undefined, 즉 정의되지 않았습니다. 이 속성은 직접 변경할 수 없습니다.

예제 dotAll 사용하기
const str1 = "bar\nexample foo example";

const regex1 = /bar.example/s;

console.log(regex1.dotAll); // true

console.log(str1.replace(regex1, "")); // foo example

const str2 = "bar\nexample foo example";

const regex2 = /bar.example/;

console.log(regex2.dotAll); // false

console.log(str2.replace(regex2, ""));
// bar
// example foo example
명세서 브라우저 호환성 같이보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4