Closed
Bug 588076
Opened 14 years ago
Closed 14 years ago
"1+2".replace("1+2", "$&+3"); returns "1+2",should be "1+2+3"
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 587366
People
(Reporter: alice0775, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4pre) Gecko/20100817 Minefield/4.0b4pre ID:20100817040615
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4pre) Gecko/20100817 Minefield/4.0b4pre ID:20100817040615
When execute the following code, returns wrong value.
"1+2".replace("1+2", "$&+3");
Actual Results:
"1+2"
No error in error console,
Expected Results:
should be "1+2+3"
Regression pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=0ee09dea0911&tochange=fc6783c960ca
WORKAROUND:
"1+2".replace(/1\+2/, "$&+3");
I do not know whether this is related to Bug 587366
Comment 1•14 years ago
|
||
Duplicate, but thanks again for reporting. If you interpret the searchValue as a regular expression, you're looking for /1+2/, which matches strings like "111112" but not the string "1+2". That bug will be done soon.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•