Gets all of the matches found when matching a regular expression against a string.
The string to match the regular expression against.
The regular expression to match against str. This regular expression will be matched after if the global flag was set.
Optional. If provided, this function will receive each match and the return value will be appended to the array which will be returned by matchAll(). The arguments will directly correspond to the parenthesized capture groups. The this object will be an array of the arguments passed to the function. The this object will additionally have an index value indicating where the match starts, an input value which is a copy of str, and a source value which is the regular expression used to get all of the matches.
If the regular expression matched at least once, an array of all of the matches will be returned. Each match will at least have match, match.index, match.source and match.input. If capture groups were specified in the regular expression, each will be found in its corresponding index starting with match. If no matches were found, null is returned.