Closed
Bug 534951
Opened 15 years ago
Closed 15 years ago
Wrong successive matches when using regular expression with 'g' flag
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: michal, Unassigned)
Details
Attachments
(1 file)
365 bytes,
text/html
|
Details |
Expected result of attached testcase is :
a
c
The actual result is that the script runs forever. First match of regexp_parse("abcd") is "ab" ("a" is remembered using parentheses). Then it recursively calls regexp_parse("a") that doesn't match anything. Next match should be "cd" but it is "ab" again. So it gets stuck in the loop.
Strange is that everything works as expected if regular expression is created using new RegExp("(.).", "g") instead of /(.)./g
Comment 1•15 years ago
|
||
We conform to ES3, which specifies this buggy behavior for RegExp literals (that they are singletons with shared mutable state).
/be
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•