-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b34
-
generic
-
generic
While working on JDK-8172353 I found that the String.prototypye.match function when used with a global regular expression has a similar issue as String.prototype.replace in JDK-8164708, i.e. strictly following the specification of ES5 [1] the function will match empty strings twice.
[1]: http://es5.github.io/#x15.5.4.10
This was fixed in ES6 [2]. Since JS implementations used to only match empty strings once before ES6, this should be considered a specification bug, and we should implement the ES6 behaviour.
[2]: https://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@match
[1]: http://es5.github.io/#x15.5.4.10
This was fixed in ES6 [2]. Since JS implementations used to only match empty strings once before ES6, this should be considered a specification bug, and we should implement the ES6 behaviour.
[2]: https://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype-@@match