Closed
Bug 67773
Opened 24 years ago
Closed 24 years ago
Regexp problem, When having (foo)+, moz ignores '+'
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: mar_garina, Assigned: rogerl)
References
()
Details
(Keywords: js1.5)
Attachments
(3 files)
2.51 KB,
patch
|
Details | Diff | Splinter Review | |
6.05 KB,
patch
|
Details | Diff | Splinter Review | |
6.77 KB,
patch
|
Details | Diff | Splinter Review |
(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.
Assignee | ||
Comment 1•24 years ago
|
||
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
Assignee | ||
Comment 2•24 years ago
|
||
Comment 4•24 years ago
|
||
Testcase added to JS test suite -
js/tests/ecma_3/RegExp/regress-67773.js
Keywords: js1.5
OS: Linux → All
Comment 5•24 years ago
|
||
cc'ing potential reviewers. It would be nice to get this into JS1.5 RC3 -
Assignee | ||
Comment 6•24 years ago
|
||
Comment 9•24 years ago
|
||
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
Assignee | ||
Comment 10•24 years ago
|
||
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)
Assignee | ||
Comment 11•24 years ago
|
||
Comment 12•24 years ago
|
||
sr=brendan@mozilla.org. Who should r=? Maybe rginda or shaver?
/be
Comment 13•24 years ago
|
||
r=rginda
Assignee | ||
Comment 14•24 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 15•24 years ago
|
||
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
Comment 16•24 years ago
|
||
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.
Comment 17•24 years ago
|
||
(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.
Description
•