Index: src/regexp.js |
diff --git a/src/regexp.js b/src/regexp.js |
index faa525d62da27ca518e3b4fa8ec12f6ab2cbdaa8..59c40407fbc20ddc4406d0ef2661d7d9bcf39099 100644 |
--- a/src/regexp.js |
+++ b/src/regexp.js |
@@ -186,10 +186,10 @@ function RegExpExec(string) { |
%_IsRegExpEquivalent(cache.regExp, this) && |
%_ObjectEquals(cache.subject, string)) { |
if (cache.answerSaved) { |
- // If this regexp is not global, cache.lastIndex is zero, so we only get |
+ // If this regexp is global, cache.lastIndex is zero, so we only get |
// here if this.lastIndex is zero, and resulting this.lastIndex |
// must be zero too, so no change is necessary. |
- if (this.global) this.lastIndex = lastMatchInfo[CAPTURE1]; |
+ if (!this.global) this.lastIndex = lastMatchInfo[CAPTURE1]; |
return %_RegExpCloneResult(cache.answer); |
} else { |
saveAnswer = true; |