Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191819

String.prototype.match should follow ES6 specification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • core-libs
    • 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

            hannesw Hannes Wallnoefer
            hannesw Hannes Wallnoefer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: