Matches a string and returns an iterable of matches containing the results of the match.
matchAll(value)
value
A string or a regular expression object.
An iterable of matches containing the results of the match.
for (const match of "banana".matchAll(/an/g)) {
print(match[0], match.index, match.input, match.groups)
}
an 1 banana undefined
an 3 banana undefined