Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8011700 More compatibility issues reported by André Bargull on nashorn-dev
  3. JDK-8016542

String.prototype.replace called with function argument should not replace $ patterns

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Fixed
    • P4
    • 8
    • None
    • core-libs
    • None
    • b96
    • Verified

    Description

      The following should return "abc" as $& is a replacement pattern for the matched string:

      "abc".replace("c", "$&");

      However the following should return "ab$&":

      "abc".replace("c", function(){return "$&"})

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: