RegExp.prototype.multiline

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

multiline 접근자 속성은 m 플래그가 정규표현식에 사용되었는지 여부를 나타냅니다.

시도해보기

const regex1 = new RegExp("^football");
const regex2 = new RegExp("^football", "m");

console.log(regex1.multiline);
// Expected output: false

console.log(regex2.multiline);
// Expected output: true

console.log(regex1.test("rugby\nfootball"));
// Expected output: false

console.log(regex2.test("rugby\nfootball"));
// Expected output: true

설명

m 플래그가 사용된 경우 RegExp.prototype.multilinetrue 값을 가지며, 그렇지 않으면 false 값을 갖습니다. m 플래그는 여러 줄 입력 문자열을 여러 줄로 처리해야 함을 나타냅니다. 예를 들어, m이 사용되면 ^$는 전체 문자열의 시작 또는 끝에서만 일치하는 것에서 문자열 내의 모든 줄의 시작 또는 끝에서 일치하는 것으로 변경됩니다.

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

예제

multiline 사용하기

js
const regex = /foo/m;

console.log(regex.multiline); // true

명세서

Specification
ECMAScript® 2025 Language Specification
# sec-get-regexp.prototype.multiline

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
multiline
Prototype accessor property (ES2015)

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기