Usually when you do something like \'test\'.match(/(e)/) you would receive an array [\'e\', \'e\'], where the first element is the match itself and the
The behavior is specified at ECMA script language spec. This section describes in detail the procedure followed by the regex engine with and without the global modifier.
Specific at point 11: If global is true,
Call the [[Put]] internal method of R with arguments "lastIndex", e, and true.