Es6-regexp-prototype-multiline

提供:Dev Guides
2020年6月23日 (火) 08:04時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

ES6-RegExpマルチライン

multilineは、RegExpオブジェクトの読み取り専用のブールプロパティです。 特定の正規表現が複数行一致を実行するかどうか、つまり「m」属性で作成されたかどうかを指定します。

構文

RegExpObject.multiline

戻り値

「m」修飾子が設定されている場合は「TRUE」、それ以外の場合は「FALSE」を返します。

var re = new RegExp( "string" );
if ( re.multiline ){
   console.log("Test1-multiline property is set");
} else {
   console.log("Test1-multiline property is not set");
}
re = new RegExp( "string", "m" );

if ( re.multiline ){
   console.log("Test2-multiline property is set");
} else {
   console.log("Test2-multiline property is not set");
}

出力

Test1-multiline property is not set
Test2-multiline property is set