Closed Bug 67773 Opened 24 years ago Closed 24 years ago

Regexp problem, When having (foo)+, moz ignores '+'

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: mar_garina, Assigned: rogerl)

References

()

Details

(Keywords: js1.5)

Attachments

(3 files)

(I use mozilla build 20010202 , linux) Description of the problem: When regexp has, for example \w+ , it means that the string should contain an alphanumeric character at least once, but also MORE THAN ONE (that's the +'s job). If I want a more complicated string, such as alphanumeric char and later a '-' to show up more than once, it should be inside brackets, and then a '+'- (\w+\-)+ . This works great on netscape 4.x, but on mozilla it ignores the +, so 'bla-' is accepted, but 'bla-bla-' isn't. How it should be: 'bla-bla-' should be also accepted. How to reproduce: http://www.deot.net/jsbug2.html , I put there the exact problem.
Nuts, another one for the regression suite. Issue here is that the $ forces the sub-expression to fail to run to completion, even though it has a succesful match half-way through. This is just the opposite case of the last '?' bugs where I needed the sub-expression to back-track from a failed completion. Patch coming up.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Note: the regexp '?'-character issue Roger mentioned was bug 57572 -
Testcase added to JS test suite - js/tests/ecma_3/RegExp/regress-67773.js
Keywords: js1.5
OS: Linux → All
cc'ing potential reviewers. It would be nice to get this into JS1.5 RC3 -
*** Bug 69989 has been marked as a duplicate of this bug. ***
cc'ing Stephen and Boris, contributors to bug 69989 -
Looks good, I'm inclined to rs= (rubberstamp= :-). One question: @@ -1397,15 +1396,15 @@ } if ((grState->maxKid == 0) || (++grState->kidCount < grState->maxKid)) { match = greedyRecurse(grState, kidMatch, cp); - if (match) return match; + if (match) + return match; --grState->kidCount; } Do you really want to --grState->kidCount if grState->maxKid was 0 at the if condition? In that case, the ++grState->kidCount never happened. Also, what happens if grState->kidCount >= grState->maxKid? It'll equal once, then keep going, so long as maxKid is non-zero and this block is reached. /be
Thank you; yes, that's not right. The most recent change can bring us right back here without resetting kidcount. I'll add a new patch. {in fact in trying to find a test case, i found that the counted quantifier wasn't setting the paren value right so the new patch fixes that too)
sr=brendan@mozilla.org. Who should r=? Maybe rginda or shaver? /be
r=rginda
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified Fixed on WinNT, Linux, and Mac. The testcase js/tests/ecma_3/RegExp/regress-67773.js passes in the standalone JS shell on all three platforms -
Status: RESOLVED → VERIFIED
My testcase from bug 69989 still does not work. (Build ID: 2001030813 Linux) http://bugzilla.mozilla.org/showattachment.cgi?attach_id=26027 That bug was marked a duplicate of this bug, but the fix for this bug did not fix that one. I'm reopening bug 69989.
(Note: we have found the testcase from bug 69989 does work. So both that bug and this one remain Verified Fixed)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: