Closed Bug 428703 Opened 16 years ago Closed 16 years ago

/[\d-z]/.exec("-") does not throw

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 351463

People

(Reporter: x00000000, Unassigned)

References

()

Details

/[\d-z]/.exec("-") should throw per ECMA.

If that won't fix, as bug 351463 (which refers to bug 375876 that isn't readable for me) suggests, then there should be a comment in the code that explains the reason.

Note that /[ -\d]/ does throw and that /[\d-]/ shouldn't throw.

Opera has the same behavior as Mozilla.
Can you include the ECMA citation for this?
ECMA 262-3 15.10.2.15:

| The internal helper function CharacterRange takes two CharSet parameters
| A and B and performs the following:
|
| 1. If A does not contain exactly one character or B does not contain exactly
|    one character then throw a SyntaxError exception.
[...]

[\d\D\s\S\w\W] return CharSets containing more than one character (15.10.2.12).
Ah, right.  Thanks for refreshing my memory.  I've copied you to the original bug on this same issue, and am duping this bug to that one.  Please feel free to contribute there.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.