Closed Bug 448443 Opened 16 years ago Closed 13 years ago

Adding (?:...) to a regexp causes it to fail to match

Categories

(Rhino Graveyard :: Core, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 369860

People

(Reporter: mikesamuel, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080513 Firefox/2.0.0.14
Build Identifier: Rhino 1.7 release 1 2008 03 06

On Rhino,
    /^(?:(?:a(?:b))c)$/.test("abc")
    false
but in the squarefree shell, both return true.

Removing the extra parenthetical group causes it to return true on both.
    /^(?:a(?:b)c)$/.test("abc")
    test

The second example is identical to the first but misses a non-capturing parenthetical grouping.

Reproducible: Always

Steps to Reproduce:
Enter the two testcases above in Rhino's interactive shell and in http://www.squarefree.com/shell/shell.html on Firefox 2.0.0.14.
Actual Results:  
/^(?:(?:a(?:b))c)$/.test("abc") === false

Expected Results:  
/^(?:(?:a(?:b))c)$/.test("abc") === true
My patch in pull request #19 ( https://github.com/mozilla/rhino/pull/19 ) will fix this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.