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

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P4
    • 8
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b96
    • Verified

      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 "$&"})

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

              Created:
              Updated:
              Resolved: