Closed Bug 476146 Opened 16 years ago Closed 11 years ago

Missing capture in Spidermonkey regexp engine

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: erik, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.18) Gecko/20081117 Firefox/2.0.0.18 Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.18) Gecko/20081117 Firefox/2.0.0.18 The above regexp doesn't capture the first b. Reproducible: Always Steps to Reproduce: 1. javascript:alert(/^(b+|a){1,2}?bc/.exec("bbc")) 2. 3. Actual Results: bbc, Expected Results: bbc,b From the PCRE test suite. Works fine in other browsers.
Firefox 2 has reached its EOL and is no longer supported, please upgrade to the current 3.0 Branch. Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Works fine for me.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
I can reproduce this in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2 so I don't think it's a FF2 issue.
If I add a ? after the + to make the regexp non-greedy then it works correctly. A probably related issue, also from the PCRE test suite: javascript:alert(/((\3|b)\2(a)){2,}/.exec("bbaababbabaaaaabbaaaabba")) gives abba,bba,b,a Should give bbaa,a,,a Again, with the abba example it works correctly if I add a ? after the } to make it non-greedy.
OS: Linux → All
Hardware: x86 → All
Most likely, yes.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Thanks for unduping, since the dupe was erroneously marked invalid.
Works at least since FF 24: I just tested in the version 24 SpiderMonkey shell.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.