Closed Bug 254296 Opened 21 years ago Closed 21 years ago

javascript regular expression negative lookahead

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.8alpha3

People

(Reporter: kal_el_1938, Assigned: brendan)

Details

(Keywords: fixed-aviary1.0, fixed1.7.5, js1.5, Whiteboard: needed-aviary1.0)

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1 Using client-side javascript regular expression a negative lookahead (?!) the look-ahead fails before the entire group is evaluated. Seem to short-curciut For example ^\d(?!\.\d) ,a digit not followed by a decimal and a digit,fails to match 3.A because it the digit is followed by a decimal. Doesn't check to see if the decimal was followed by a digit. The same expression tested using IE and Opera matched 3.A Used the webpage http://www.unusualresearch.com/regex/toolrei.htm to test with. Reproducible: Always Steps to Reproduce: 1.Used the webpage http://www.unusualresearch.com/regex/toolrei.htm or http://www.regexlib.com/RETester.aspx with javascript option using Mozilla or Firefox 2. use regular expression ^\d(?!\.\d) 3.Test with string 3.A Actual Results: No match was found Expected Results: Found 1 match
Sweet, sweet regexp, as shaver would say. Rogerl's big rewrite regained the long-lost Netscape 4.x-era bytecoded NFA performance, but here's yet another bug as fallout, or payback. /be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.7.3+
Flags: blocking-aviary1.0+
Keywords: js1.5
Target Milestone: --- → mozilla1.8alpha3
Attached patch proposed fixSplinter Review
Both REOP_ASSERT and REOP_ASSERT_NOT assumed that a leading "simple" reop was all there was in the assertion, failing to see whether SimpleMatch advanced pc to the next pc after the assertion.
Attachment #155753 - Flags: review?(shaver)
Status: NEW → ASSIGNED
Comment on attachment 155753 [details] [diff] [review] proposed fix I wonder how many more licks we need to get to the centre. r=shaver.
Attachment #155753 - Flags: review+
Comment on attachment 155753 [details] [diff] [review] proposed fix Should get into all active branches ASAP. /be
Attachment #155753 - Flags: review?(shaver)
Attachment #155753 - Flags: approval1.7.3?
Attachment #155753 - Flags: approval-aviary?
Fixed on the trunk. /be
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Whiteboard: needed-aviary1.0
Comment on attachment 155753 [details] [diff] [review] proposed fix a=dveditz for 1.7.3
Attachment #155753 - Flags: approval1.7.3? → approval1.7.3+
Attachment #155753 - Flags: approval-aviary? → approval-aviary+
Fixed on MOZILLA_1_7_BRANCH and AVIARY_1_0_20040515_BRANCH. /be
Keywords: fixed1.7fixed1.7.x
Michael, with your permission this will be included in the javascript test library.
(In reply to comment #9) > Created an attachment (id=174927) [edit] > js1_5/Regress/regress-254296.js > > Michael, with your permission this will be included in the javascript test > library. Sure. Glad I could help
js/testsjs1_5/Regress/regress-254296.js checked in. Thanks Michael!
Flags: testcase+
verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: