Re: Regular expression /\d/ matches "digits" other than [0-9]
Martin Honnen <[email protected]> Wed, 25 Apr 2007 16:19:25 +0200
| Newsgroups | gmane.comp.mozilla.internationalization |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
Igor Tandetnik wrote:
> /\d/.test("\uFF11")
>
> returns true. U+FF11 is FULLWIDTH DIGIT ONE, and happens to have Unicode
> class Nd (decimal number). However, Ecma-262 (the standard for
> EcmaScript aka JavaScript) explicitly states:
>
> 15.10.2.12 CharacterClassEscape
> The production CharacterClassEscape :: d evaluates by returning the
> ten-element set of characters containing the characters 0 through 9
> inclusive.
>
> So accepting "digits" other than [0-9] appears to be a bug. Am I missing
> something obvious?
Looks like a long standing bug in Spidermonkey. Rhino gives false for
that example.
I have filed <https://bugzilla.mozilla.org/show_bug.cgi?id=378738>.
--
Martin Honnen
http://JavaScript.FAQTs.com/