diff --git a/Makefile b/Makefile index 76b8da4..1e24bc7 100644 --- a/Makefile +++ b/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) diff --git a/type_regexp.go b/type_regexp.go index 0d870b4..3a65400 100644 --- a/type_regexp.go +++ b/type_regexp.go @@ -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) }