RegExp.prototype.compile()
Deprecated
Avoid using this feature in new projects.
The compile() method duplicates behavior of the RegExp() constructor and it exists only for backwards compatibility.
This feature may be a candidate for removal from web standards or browsers. >
ã¡ã¢:
compile() ã¡ã½ããã¯äºææ§ã®ããã«ã®ã¿å®ç¾©ããã¦ãã¾ããcompile() ã使ç¨ããã¨ãããã¾ã§ä¸å¤ã§ãã£ãæ£è¦è¡¨ç¾ã®ã½ã¼ã¹ã¨ãã©ã°ã夿´å¯è½ãªãã®ã¨ãªããã¦ã¼ã¶ã¼ã®æå¾
ãè£åãå¯è½æ§ãããã¾ãã代ããã« RegExp() ã³ã³ã¹ãã©ã¯ã¿ã¼ã使ç¨ãã¦æ°ããæ£è¦è¡¨ç¾ãªãã¸ã§ã¯ããæ§ç¯ãã¦ãã ããã
compile() 㯠RegExp ã¤ã³ã¹ã¿ã³ã¹ã®ã¡ã½ããã§ã RegExp ãªãã¸ã§ã¯ããæ¢ã«ä½æãããå¾ãæ°ããã½ã¼ã¹ã¨ãã©ã°ã§æ£è¦è¡¨ç¾ãåã³ã³ãã¤ã«ããããã«ä½¿ç¨ãã¾ãã
æ§æ
compile(pattern, flags)
弿°
pattern-
æ£è¦è¡¨ç¾ã®ããã¹ã
flags-
ãã©ã°å¤ã®çµã¿åããã§ãã
è¿å¤
ãªã (undefined)ã
ä¾
>compile() ã®ä½¿ç¨
次ã®ä¾ã§ã¯ãæ°ãããã¿ã¼ã³ã¨ãã©ã°ã§æ£è¦è¡¨ç¾ãåã³ã³ãã¤ã«ããæ¹æ³ã示ãã¾ãã
const regexObj = /foo/gi;
regexObj.compile("new foo", "g");
仿§æ¸
| 仿§æ¸ |
|---|
| ECMAScript® 2027 Language Specification > # sec-regexp.prototype.compile > |