Baseline Widely available
Symbol.matchAll
ì ì ë°ì´í° ìì±ì ì ìë ¤ì§ ì¬ë³¼ @@matchAll
ì ëíë
ëë¤. String.prototype.matchAll()
ë©ìëë 문ìì´ê³¼ íì¬ ê°ì²´ì ì¼ì¹ í목ì ì°ì¶íë ë°ë³µì를 ë°ííë ë©ìëì 첫 ë²ì§¸ ì¸ììì ì´ ì¬ë³¼ì ì¡°íí©ëë¤.
ë ë§ì ì 보를 ì°¸ê³ íìë ¤ë©´ RegExp.prototype[@@matchAll]()
ì String.prototype.matchAll()
를 ì°¸ê³ íì기 ë°ëëë¤.
const re = /[0-9]+/g;
const str = "2016-01-02|2019-03-07";
const result = re[Symbol.matchAll](str);
console.log(Array.from(result, (x) => x[0]));
// Expected output: Array ["2016", "01", "02", "2019", "03", "07"]
ê°
ì ìë ¤ì§ ì¬ë³¼ @@matchAll
.
const str = "2016-01-02|2019-03-07";
const numbers = {
*[Symbol.matchAll](str) {
for (const n of str.matchAll(/[0-9]+/g)) yield n[0];
},
};
console.log(Array.from(str.matchAll(numbers)));
// ["2016", "01", "02", "2019", "03", "07"]
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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