mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-06 01:41:37 +08:00
Reset the lastIndex property in String.match() and replace().
This commit is contained in:
@@ -336,6 +336,8 @@ static int Sp_match(js_State *J, int argc)
|
||||
if (!(re->flags & JS_REGEXP_G))
|
||||
return js_RegExp_prototype_exec(J, re, text);
|
||||
|
||||
re->last = 0;
|
||||
|
||||
js_newarray(J);
|
||||
|
||||
e = strlen(text);
|
||||
@@ -400,6 +402,8 @@ static int Sp_replace_regexp(js_State *J, int argc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
re->last = 0;
|
||||
|
||||
loop:
|
||||
s = source + m[0].rm_so;
|
||||
n = m[0].rm_eo - m[0].rm_so;
|
||||
|
||||
Reference in New Issue
Block a user