Closed Bug 330796 Opened 18 years ago Closed 12 years ago

"Invalid quantifier" error message shows wrong part of regexp

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jruderman, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

Steps to reproduce:
1. new RegExp("(a**cd)")

Result: 

The error message includes the entire rest of the regular expression.
"SyntaxError: invalid quantifier *cd)"

Expected: 

Either it should work (with a** equivalent to (a*)*), or it should have a sensible error message (such as "invalid quantifier **" or "you can't put a quantifier right after a quantifier").

P.S. Safari accepts regular expressions like this, but they don't do what I'd expect.  For example, it accepts /a**/, but I can't find a string for which /a**/.test(...) is true in Safari.
Attached file testcase
See also bug 332472, another bug involving this error message.
Safari uses PCRE, which does not follow ECMA-262 Edition 3 fully.

This is not related to bug 332472, which concerns dependent string input to new RegExp.  Here, the string input can be independent, but the diagnostic will show the wrong suffix of that string.

/be
Blocks: jserror
These days, the testcase just says "invalid quantifier". Chrome says "Invalid regular expression: /(a**cd)/: Nothing to repeat".
Flags: in-testsuite?
OS: Mac OS X → All
Hardware: PowerPC → All
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: