529
const matchLength = m[0].length;
530
if (matchStartIndex === this._prevMatchStartIndex && matchLength === this._prevMatchLength) {
532
>
// the search result is an empty string and won't advance `regex.lastIndex`, so `regex.exec` will stuck here
533
>
// we attempt to recover from that by advancing by two if surrogate pair found and by one otherwise
534
>
if (strings.getNextCodePoint(text, textLength, this._searchRegex.lastIndex) > 0xFFFF) {
535
this._searchRegex.lastIndex += 2;
537
>
this._searchRegex.lastIndex += 1;
538
>
}
539
>
continue;
540
>
}
541
// Exit early if the regex matches the same range twice
542
return null;