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

RESOLVED DUPLICATE of bug 351463

Status

()

RESOLVED DUPLICATE of bug 351463
11 years ago
11 years ago

People

(Reporter: x00000000, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
/[\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.

Comment 1

11 years ago
Can you include the ECMA citation for this?
(Reporter)

Comment 2

11 years ago
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).

Comment 3

11 years ago
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
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 351463
You need to log in before you can comment on or make changes to this bug.