Baseline Widely available
RegExp
ì¸ì¤í´ì¤ì hasIndices
ì ê·¼ì ìì±ì ì´ ì ê· ííìê³¼ í¨ê» d
íëê·¸ê° ì¬ì©ëëì§ ì¬ë¶ë¥¼ ë°íí©ëë¤.
const regex1 = new RegExp("foo", "d");
console.log(regex1.hasIndices);
// Expected output: true
const regex2 = new RegExp("bar");
console.log(regex2.hasIndices);
// Expected output: false
ì¤ëª
d
íëê·¸ê° ì¬ì©ë ê²½ì° RegExp.prototype.hasIndices
ë true
ê°ì ê°ì§ë©°, ê·¸ë ì§ ìì ê²½ì° false
ê°ì ê°ìµëë¤. d
íëê·¸ë ì ê· ííì ì¼ì¹ ê²°ê³¼ì ê° ìº¡ì² ê·¸ë£¹ì íì 문ìì´ì ìì ë° ë ì¸ë±ì¤ê° í¬í¨ë¨ì ëíë
ëë¤. ì´ íëê·¸ë ì ê· ííìì í´ìì´ë ì¼ì¹ ëìì ì´ë¤ ìì¼ë¡ë ë³ê²½íì§ ìì¼ë©° ì¼ì¹ ê²°ê³¼ì ì¶ê° ì ë³´ë§ ì ê³µí©ëë¤.
ì´ íëê·¸ë ì£¼ë¡ exec()
ì ë°í ê°ì ìí¥ì ì¤ëë¤. d
íëê·¸ê° ìë ê²½ì°, exec()
ê° ë°ííë ë°°ì´ìë exec()
ë©ìëì ë°í ê°ì ì¤ëª
ë ëë¡ ì¶ê° indices
ìì±ì´ ììµëë¤. ë¤ë¥¸ 모ë ì ê·ì ê´ë ¨ ë©ìë(ì: String.prototype.match()
)ë ë´ë¶ì ì¼ë¡ exec()
ì í¸ì¶íë¯ë¡ ì ê·ìì d
íëê·¸ê° ìë ê²½ì° ì¸ë±ì¤ë ë°íí©ëë¤.
hasIndices
ì¤ì ì ê·¼ìë undefined
ì
ëë¤. ì´ ìì±ì ì§ì ë³ê²½í ì ììµëë¤.
ì¢ ë ìì¸í ì¬ì© ìì ë 그룹과 ì참조 > 그룹과 ì¸ë±ì¤ ì¼ì¹ ì¬ì©í기ì ììµëë¤.
hasIndices ì¬ì©í기const str1 = "foo bar foo";
const regex1 = /foo/dg;
console.log(regex1.hasIndices); // true
console.log(regex1.exec(str1).indices[0]); // [0, 3]
console.log(regex1.exec(str1).indices[0]); // [8, 11]
const str2 = "foo bar foo";
const regex2 = /foo/;
console.log(regex2.hasIndices); // false
console.log(regex2.exec(str2).indices); // undefined
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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