Index: src/regexp.js |
diff --git a/src/regexp.js b/src/regexp.js |
index 6a0e2b5d92c00782d29ef1a78b42d382b10ae55c..bb1958bbca31a647710d975ec6881bd2474c1a70 100644 |
--- a/src/regexp.js |
+++ b/src/regexp.js |
@@ -112,8 +112,10 @@ function BuildResultFromMatchInfo(lastMatchInfo, s) { |
var numResults = NUMBER_OF_CAPTURES(lastMatchInfo) >> 1; |
var start = lastMatchInfo[CAPTURE0]; |
var end = lastMatchInfo[CAPTURE1]; |
+ var first_match = %_SubString(s, start, end); |
var result = %_RegExpConstructResult(numResults, start, s); |
- result[0] = %_SubString(s, start, end); |
+ result[0] = first_match; |
Yang
2014/05/14 13:25:23
Is this change necessary?
|
+ if (numResults == 1) return result; |
var j = REGEXP_FIRST_CAPTURE + 2; |
for (var i = 1; i < numResults; i++) { |
start = lastMatchInfo[j++]; |