Closed
Bug 543663
Opened 14 years ago
Closed 13 years ago
Adding a non capturing group causes spurious RegExp matches
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 369860
People
(Reporter: mikesamuel, Unassigned)
Details
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.49 Safari/532.5
Build Identifier: Rhino 1.7 release 1 2008 03 06
Spurious regular expression matches occur when non-capturing groups are used.
The RegExp below fails.
/(?:xy)$/
It should match any string and only strings that ends with xy, but spuriously matches some strings that do not even contain the character y.
Reproducible: Always
Steps to Reproduce:
Run the interactive shell as below:
> java -jar rhino/js.jar
Rhino 1.7 release 1 2008 03 06
js> /(?:xy)$/.test("x")
true
js> /xy$/.test("x")
false
js>
Actual Results:
The javascript expression
/(?:xy)$/.test("x")
yields true.
Expected Results:
The javascript expression
/(?:xy)$/.test("x")
yields false.
Reporter | ||
Comment 1•14 years ago
|
||
This is still present in the latest release. )> java -jar /tmp/rhino1_7R2/js.jar Rhino 1.7 release 2 2009 03 22 js> /(?:xy)$/.test("x") true js> /xy$/.test("x") false js>
Comment 2•14 years ago
|
||
Hello, here is another example of a regexp with non-capturing groups that fails. The example below should return true: java -jar js.jar Rhino 1.7 release 2 2009 03 22 js> /^(?:AB)|(?:CD)$/.test("CD") false
Comment 3•13 years ago
|
||
My patch in pull request #19 ( https://github.com/mozilla/rhino/pull/19 ) will fix this bug.
Updated•13 years ago
|
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.
Description
•