RESOLVED INVALID 200714
String.prototype.replace truncates $<number> values
https://bugs.webkit.org/show_bug.cgi?id=200714
Summary String.prototype.replace truncates $<number> values
matt
Reported 2019-08-14 07:36:27 PDT
# 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
Attachments
matt
Comment 1 2019-08-14 07:39:08 PDT
Radar WebKit Bug Importer
Comment 2 2019-08-14 09:59:13 PDT
matt
Comment 3 2019-08-19 01:18:27 PDT
After further investigation, this issue looks to be caused by an old String.prototype.replace polyfill from core-js@2.0.3. Ref: https://github.com/zloirock/core-js/blob/v2.0.3/modules/es6.regexp.replace.js
Note You need to log in before you can comment on or make changes to this bug.