Closed
Bug 46429
Opened 25 years ago
Closed 25 years ago
Regexp matching error in JS Engine
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: pat, Assigned: rogerl)
References
Details
(Whiteboard: [nsbeta3+])
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.13 i686; en-US; m17) Gecko/20000724
BuildID: 2000072420
The match property of a String object in javascript produces an erroneus match
inside a bookmarklet
Reproducible: Always
Steps to Reproduce:
1. create a new bookmarklet by pasting the javascript code below into a new bookmark
2. click on the bookmark, executing the bookmarklet (you must have javascript
turned on for this)
3. the code produces an alert box illustrating the way the string was matched
against the regexp
Actual Results: the alert box says:
~aa123bb -> [123bb] [123bb] [123] [bb]
Expected Results: it should say (and does so in Netscape 4.x ):
~aa123bb -> [~aa123bb] [~aa] [123] [bb]
Testcase: (jacascript code from a bookmarklet)
----
javascript:string="~aa123bb"; regexp=/(.*[a-z])?(\d+)(\w*)/;
result = string.match(regexp);
alert(string+ " -> ["+result[0]+"] ["+result[1]+"] ["+result[2]+"]
["+result[3]+"]");
------
The regexp is supposed to break up the string into a an optional part ending
with a letter, then a number and then more letters. Note: It seems to work for
just matching the first 2 parts of the regexp against "~aa123"
Comment 1•25 years ago
|
||
I can confirm this with 2000080113 on Linux.
Addtionally the console spits the following out:
Error loading URL javascript:string="~aa123bb"; regexp=/(.*[a-z])?(\d+)(\w*)/;
result = string.match(regexp); alert(string+ " -> ["+result[0]+"]
["+result[1]+"] ["+result[2]+"] ["+result[3]+"]");
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 2•25 years ago
|
||
This is an example of failures in the general case of ([a-z]*[a-z])*b (i.e. the
outer back-tracker is not informed of success by the inner back-tracker). Urgh.
Status: NEW → ASSIGNED
Keywords: nsbeta3
Comment 3•25 years ago
|
||
Updating summary -
Summary: javascript regexp matching error (in bookmarklet) → Regexp matching error in JS Engine
*** Bug 48568 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 7•25 years ago
|
||
Fix checked in
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•