Bug 23409 - REGRESSION: RegExp 'replace()' function improperly processes '$$'
Summary: REGRESSION: RegExp 'replace()' function improperly processes '$$'
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Darin Adler
Keywords: EasyFix, HasReduction, InRadar, Regression
Depends on:
Reported: 2009-01-17 17:28 PST by William J. Edney
Modified: 2009-01-23 13:53 PST (History)
1 user (show)

See Also:

A testcase demonstrating how '$$' is broken. (546 bytes, text/html)
2009-01-17 17:29 PST, William J. Edney
no flags Details
patch (5.34 KB, patch)
2009-01-19 12:54 PST, Darin Adler
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description William J. Edney 2009-01-17 17:28:19 PST
All -

I've attached a testcase that shows that Webkit's JS engine is no longer properly processing '$$' when present in a replace() using a RegExp, where the replacement is a String (in Safari 3.2.X, this is working fine).

Within the replacement String, '$' is used as a metacharacter along with a number or other special character to reference part of a match. Therefore, to output a '$', you need to use '$$'. This should output a single '$'.

But in the latest Webkit builds (I'm using r40000), a '$$' is output when this syntax is used. All other browsers, FF 3.0.X, IE7+, Chrome properly process this (as does Safari as mentioned above).

I've attached a small testcase.


- Bill
Comment 1 William J. Edney 2009-01-17 17:29:33 PST
Created attachment 26830 [details]
A testcase demonstrating how '$$' is broken.
Comment 2 Mark Rowe (bdash) 2009-01-18 15:46:30 PST
Comment 3 Darin Adler 2009-01-19 12:54:58 PST
Created attachment 26849 [details]
Comment 4 Darin Adler 2009-01-19 15:35:08 PST
Comment 5 William J. Edney 2009-01-23 13:53:40 PST
Verified fixed in build 40102.

Thanks guys!


- Bill