[Webkit-unassigned] [Bug 200714] New: String.prototype.replace truncates $<number> values

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 14 07:36:27 PDT 2019


            Bug ID: 200714
           Summary: String.prototype.replace truncates $<number> values
           Product: WebKit
           Version: Safari 12
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: matt at matthojo.co.uk

# Summary

When replacing with a value that contains $<number>, the value is truncated of $ and first number.

# Test

var string = "Get %{amount} credit";
var regex = new RegExp(`%{amount}`, "g");
console.log(string.replace(regex, "$100"));

# Expected

> Get $100 credit

# Actual

> Get 00 credit

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190814/5d133daf/attachment.html>

More information about the webkit-unassigned mailing list