mirror of
https://github.com/robertkrimen/otto.git
synced 2025-12-24 12:58:05 +08:00
Calculate endIndex from last place of match, not last place of last submatch
This commit is contained in:
2
Makefile
2
Makefile
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user