Baseline Widely available
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
æ å¿è¡¨ç¤ºæ£å表达å¼å¹é
çç»æåºè¯¥å
嫿¯ä¸ªæè·ç»åå符串å¼å§åç»æçç´¢å¼ãå®ä¸ä¼ä»¥ä»»ä½æ¹å¼æ¹åæ£å表达å¼çè§£éæå¹é
è¡ä¸ºï¼å®åªå¨å¹é
çç»æä¸æä¾é¢å¤çä¿¡æ¯ã
hasIndices
ç set 访é®å¨æ¯ undefined
ãä½ ä¸è½ç´æ¥ä¿®æ¹æ¤å±æ§ã
const str1 = "foo bar foo";
const regex1 = /foo/dg;
console.log(regex1.hasIndices); // Output: true
console.log(regex1.exec(str1).indices[0]); // Output: Array [0, 3]
console.log(regex1.exec(str1).indices[0]); // Output: Array [8, 11]
const str2 = "foo bar foo";
const regex2 = /foo/;
console.log(regex2.hasIndices); // Output: false
console.log(regex2.exec(str2).indices); // Output: 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