Calculate endIndex from last place of match, not last place of last submatch

This commit is contained in:
Robert Krimen
2012-11-09 15:36:08 -08:00
parent 5b38b16e99
commit 1b39f1b6cc
2 changed files with 2 additions and 2 deletions

View File

@@ -29,8 +29,8 @@ TEST := -v --run ParseFailure
TEST := -v --run RegExp
TEST := -v --run stringToFloat
TEST := -v --run TryFinally
TEST := -v --run RegExp_exec
TEST := .
TEST := -v --run RegExp_exec
test: test-i
go test $(TEST)

View File

@@ -78,7 +78,7 @@ func execRegExp(this *_object, target string) (match bool, result []int) {
return // !match
}
match = true
endIndex := int(lastIndex) + result[len(result)-1]
endIndex := int(lastIndex) + result[1]
if global {
this.set("lastIndex", toValue(endIndex), true)
}