Baseline Widely available
global
ì ê·¼ì ìì±ì g
íëê·¸ê° ì ê·ííìì ì¬ì©ëìëì§ ì¬ë¶ë¥¼ ëíë
ëë¤.
const regex1 = new RegExp("foo", "g");
console.log(regex1.global);
// Expected output: true
const regex2 = new RegExp("bar", "i");
console.log(regex2.global);
// Expected output: false
ì¤ëª
g
íëê·¸ê° ì¬ì©ë ê²½ì° RegExp.prototype.global
ì ê°ì true
ì´ê³ , ê·¸ë ì§ ìì¼ë©´ false
ì
ëë¤. g
íëê·¸ë ì ê·ìì´ ë¬¸ìì´ìì ê°ë¥í 모ë ì¼ì¹ í목ì ëí´ í
ì¤í¸ëì´ì¼ í¨ì ëíë
ëë¤. exec()
를 í¸ì¶í ëë§ë¤ lastIndex
ìì±ì´ ì
ë°ì´í¸ëë¯ë¡ ë¤ì exec()
í¸ì¶ì ë¤ì 문ììì ììë©ëë¤.
String.prototype.matchAll()
ë° String.prototype.replaceAll()
ê³¼ ê°ì ì¼ë¶ ë©ìëë 매ê°ë³ìê° ì ê·ìì¸ ê²½ì° ì ì(global)ì¸ì§ ì¬ë¶ë¥¼ íì¸í©ëë¤. ì ê·ìì @@match
ë° @@replace
ë©ìë(String.prototype.match()
ë° String.prototype.replace()
ì ìí´ í¸ì¶ë¨)ë ì ê·ìì´ ì ìì¼ ë ë¤ë¥¸ ëìì ê°ìµëë¤.
global
ì set ì ê·¼ìë undefined
, ì¦ ì ìëì§ ìììµëë¤. ì´ ìì±ì ì§ì ë³ê²½í ì ììµëë¤.
const regex = /foo/g;
console.log(regex.global); // true
const str = "fooexamplefoo";
const str1 = str.replace(regex, "");
console.log(str1); // example
const regex1 = /foo/;
const str2 = str.replace(regex1, "");
console.log(str2); // examplefoo
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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