Index: src/regexp.js |
diff --git a/src/regexp.js b/src/regexp.js |
index a3675f033248ba59ffb983967e7951476b3b1e67..da1883f3a427ec0edbdfd45af99e219071215b79 100644 |
--- a/src/regexp.js |
+++ b/src/regexp.js |
@@ -161,6 +161,7 @@ function RegExpExecNoTests(regexp, string, start) { |
lastMatchInfoOverride = null; |
return BuildResultFromMatchInfo(matchInfo, string); |
} |
+ regexp.lastIndex = 0; |
return null; |
} |
@@ -193,7 +194,7 @@ function RegExpExec(string) { |
var matchIndices = %_RegExpExec(this, string, i, lastMatchInfo); |
if (matchIndices === null) { |
- if (global) this.lastIndex = 0; |
+ this.lastIndex = 0; |
return null; |
} |
@@ -256,7 +257,10 @@ function RegExpTest(string) { |
%_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [regexp, string, lastIndex]); |
// matchIndices is either null or the lastMatchInfo array. |
var matchIndices = %_RegExpExec(regexp, string, 0, lastMatchInfo); |
- if (matchIndices === null) return false; |
+ if (matchIndices === null) { |
+ this.lastIndex = 0; |
+ return false; |
+ } |
lastMatchInfoOverride = null; |
return true; |
} |