Index: src/string.js |
diff --git a/src/string.js b/src/string.js |
index e663ec304432f00b71c88765ac4858597e029156..ca438fdde54155d967b77af501ed0724dbdb7b48 100644 |
--- a/src/string.js |
+++ b/src/string.js |
@@ -522,17 +522,15 @@ function ApplyReplacementFunction(replace, matchInfo, subject) { |
// ECMA-262 section 15.5.4.12 |
-function StringSearch(re) { |
+function StringSearch(re) { |
var regexp = new $RegExp(re); |
var s = TO_STRING_INLINE(this); |
- var last_idx = regexp.lastIndex; // keep old lastIndex |
- regexp.lastIndex = 0; // ignore re.global property |
- var result = regexp.exec(s); |
- regexp.lastIndex = last_idx; // restore lastIndex |
- if (result == null) |
- return -1; |
- else |
- return result.index; |
+ var match = DoRegExpExec(regexp, s, 0); |
+ if (match) { |
+ lastMatchInfo = match; |
+ return match[CAPTURE0]; |
+ } |
+ return -1; |
} |