The answer here is in the documentation:
If the regular expression does not include the g
flag, str.match() will return the same result as RegExp.exec(). The returned Array has an extra input property, which contains the original string that was parsed. In addition, it has an index property, which represents the zero-based index of the match in the string.
Therefore 'a b'.match(/(a|b)/i)
is the same as /(a|b)/i.exec('a b')
which will return the matched string and the captured group so, one capturing group, one additional array entry.
On the other hand:
If the regular expression includes the g
flag, the method returns an Array containing all matched substrings rather than match objects. Captured groups are not returned. If there were no matches, the method returns null.