Closed
Bug 1408576
Opened 8 years ago
Closed 8 years ago
content=content.replace(/^(.*)$/g,'a'+'$1'+'b'); doesn't replace lines in multiline text
Categories
(Firefox :: Untriaged, defect)
Tracking
()
VERIFIED
INVALID
People
(Reporter: jmichae3, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823
Steps to reproduce:
content=content.replace(/^(.*)$/g,'a'+'$1'+'b');
Actual results:
replaced 1st line of text only.
Expected results:
the g modifier to /^(.*)$/ should make it a global replace (should do all lines of text in content). i should make it case insensitive. this js syntax is a holdover from sed.
Comment 1•8 years ago
|
||
please read comments in other bugs you've filed.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•8 years ago
|
||
I didn't file this before Mr. Fujusawa.
Comment 3•7 years ago
|
||
Looks like your sample code was missing the "m" flag, which makes regular expressions multiline in JS.
(I was able to find this out fairly quickly by typing "JS regexp multiline g" into a search engine. As others have requested in other bugs you've filed: please test other browsers and do a bit of web searching to sanity-check your assumptions and check if you might just be missing something, before you assume that the problem you're seeing is a Firefox bug that needs reporting.)
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•