/g |
/y |
/yg |
|
---|---|---|---|
.exec() |
at .lI or later |
at .lI |
same as /y |
.test() |
at .lI or later |
at .lI |
same as /y |
.replace() |
ignores & resets .lI |
at .lI |
/g w/o gaps |
.replaceAll() |
ignores .lI |
TypeError |
/g w/o gaps |
.search() |
no effect | no effect | no effect |
.match() |
Array of group 0 captures | like .exec() |
/g w/o gaps |
.matchAll() |
Iterable of match objects | TypeError |
/g w/o gaps |
Legend:
.lI
means.lastIndex
- If
.lastIndex
is mentioned, it is also updated. - If
.lastIndex
is not mentioned, it is not changed.