Bug 7919

Summary: JavaScript String.prototype.replace does not respect "$&" replacements
Product: WebKit Reporter: Udo Borkowski <Udo.Borkowski>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ian, mrowe
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Description, further extension, and testcases for bug #7919 none

Udo Borkowski
Reported 2006-03-22 13:34:36 PST
The JavaScript implementation for String.prototype.replace does not respect the "$&" replacement. This sequence should be replaced with the matched text. E.g.: "and more ...".replace(/\./g, "$&") wrongly evaluates to "and more $&$&$&" Correct value would be: "and more ..." (For details see "15.5.4.11 String.prototype.replace (searchValue, replaceValue)" in "ECMA-262: ECMAScript specification", page 102 (http://www.ecma-international.org/publications/standards/Ecma-262.htm)) Please also verify if the other "$" replacements documented there are supported. (I used Safari 2.0.3)
Attachments
Description, further extension, and testcases for bug #7919 (2.64 KB, text/html)
2006-05-16 02:31 PDT, Adam Bergmark
no flags
Mark Rowe (bdash)
Comment 1 2006-03-22 15:04:42 PST
Confirmed with WebKit 417.9.2 and SVN r13434.
Adam Bergmark
Comment 2 2006-05-16 02:31:57 PDT
Created attachment 8348 [details] Description, further extension, and testcases for bug #7919 Open the HTML file in your browser, click the buttons to run the test cases.
mitz
Comment 3 2006-12-19 10:10:43 PST
*** This bug has been marked as a duplicate of 9234 ***
Note You need to log in before you can comment on or make changes to this bug.