Baseline Widely available
dotAll
㯠RegExp
ã¤ã³ã¹ã¿ã³ã¹ã®ã¢ã¯ã»ãµã¼ããããã£ã§ãæ£è¦è¡¨ç¾ã§ s
ãã©ã°ã使ç¨ããã¦ãããã©ããã示ãã¾ãã
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
解説
RegExp.prototype.dotAll
ã®å¤ã¯ s
ãã©ã°ã使ç¨ããã¦ããå ´å㯠true
ããã以å¤ã®å ´å㯠false
ã§ããs
ãã©ã°ã¯ããããç¹æ®æå (.
) ã追å ã§è¡æ«è¨å· ("newline") æåã¨ä¸è´ãããã¨ã示ãã¾ãããã以å¤ã®å ´åã¯ä¸è´ãã¾ããã
\n
)\r
)ããã¯äºå®ä¸ãããããåºæ¬å¤è¨èªé¢ (BMP) ã®ãã¹ã¦ã®æåã¨ä¸è´ãããã¨ãæå³ãã¾ããã¢ã¹ãã©ã«æåã¨ä¸è´ãããã«ã¯ãu
(Unicode) ãã©ã°ã使ç¨ããå¿
è¦ãããã¾ãã両æ¹ã®ãã©ã°ãçµã¿åããã¦ä½¿ç¨ããã¨ããããã¯ä¾å¤ãªãä»»æã® Unicode æåã«ä¸è´ãã¾ãã
dotAll
ã®è¨å®ã¢ã¯ã»ãµã¼ã¯ undefined
ã§ãããã®ããããã£ãç´æ¥å¤æ´ãããã¨ã¯ã§ãã¾ããã
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