@@ -674,7 +674,7 @@ namespace Js
const bool isSticky = pattern->IsSticky();
CharCount offset;
if (!GetInitialOffset(isGlobal, isSticky, regularExpression, inputLength, offset))
- return false;
+ return scriptContext->GetLibrary()->GetFalse();
if (offset <= inputLength)
{
@@ -115,6 +115,11 @@ test(/(?:)/g /*lastIndex=0*/ , "axbxcxd", 4);
true
r.lastIndex=4
RegExp.${_,1,...,9}=["axbxcxd","","","","","","","","",""]
+****** lastIndex above MaxCharCount
+test(/x/g /*lastIndex=0*/ , "axbxcxd", 9007199254740991);
+false
+r.lastIndex=0
+RegExp.${_,1,...,9}=["axbxcxd","","","","","","","","",""]
*************
*** Match ***
@@ -275,6 +275,8 @@ test(rel, s1, 4);
echo("****** Global empty regex");
test(reg, s1, 0);
test(reg, s1, 4);
+echo("****** lastIndex above MaxCharCount");
+test(rg, s1, Number.MAX_SAFE_INTEGER);
echo("*************");
echo("*** Match ***");