summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-04-23 03:32:37 +0430
committerLinus Groh <mail@linusgroh.de>2021-04-23 10:05:04 +0200
commit2ef5b138ee306f9df099d4ea795b15dea3d43aa7 (patch)
treebbdbe8bad2599a9901fb8e01c2012179bc7e4392 /Userland/Libraries/LibJS
parenta697a2a37a081e9f16e26a0945af513cb37a246f (diff)
downloadserenity-2ef5b138ee306f9df099d4ea795b15dea3d43aa7.zip
LibJS: Use the match's global offset for 'index' in RegExp.exec()
This was not noticed before because all the previous matches were single-line.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
index d4b7861219..182d7a00fb 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
@@ -168,7 +168,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::exec)
// FIXME: Do code point index correction if the Unicode flag is set.
auto* array = Array::create(global_object);
array->indexed_properties().set_array_like_size(result.n_capture_groups + 1);
- array->define_property(vm.names.index, Value((i32)match.column));
+ array->define_property(vm.names.index, Value((i32)match.global_offset));
array->define_property(vm.names.input, js_string(vm, str));
array->indexed_properties().put(array, 0, js_string(vm, match.view.to_string()));