"a".match(/a*/g) // node ["a",""] perry ["a"]
"ab".match(/b*/g) // node ["","b",""] perry ["","b"]
"a".replace(/a*/g, "<>") // node "<><>" perry "<>"
Same for matchAll. No flags beyond g are involved.
When the previous match ends at the end of the haystack, the scan stops instead of taking the final zero-width match that ECMAScript's RegExpExec loop produces there.
This is what makes test_parity_regex_replace_fn_lookahead diverge from node today, and it is why the /gms rows for terminator-final subjects had to be excluded from #9427's #9408 fixture — with a comment in the file pointing here.
Found while fixing #9408/#9409; independent of both.
Same for
matchAll. No flags beyondgare involved.When the previous match ends at the end of the haystack, the scan stops instead of taking the final zero-width match that ECMAScript's
RegExpExecloop produces there.This is what makes
test_parity_regex_replace_fn_lookaheaddiverge from node today, and it is why the/gmsrows for terminator-final subjects had to be excluded from #9427's #9408 fixture — with a comment in the file pointing here.Found while fixing #9408/#9409; independent of both.