archives

« Bugzilla Issues Index

#3519 — Maybe omission: Should - be a SyntaxCharacter in regexps?


21.2.1 says:

SyntaxCharacter :: one of
^ $ \ . * + ? ( ) [ ] { } |

And if the 'u' flag is present, only syntax characters can be escaped:

IdentityEscape [U] ::
[+U] SyntaxCharacter
[~U] SourceCharacter but not UnicodeIDContinue

Is - deliberately not a syntax character? This means the user cannot write /[a-b\-f-g]/u but has to write /[a-bf-g-]/u instead.

Other regexp implementations (Python, Perl) allow \- in this context. Otoh, they allow more liberal escaping anyway, such as \a to replace a, and so on.


fixed in rev32 editor's draft

added
ClassEscape[U] :: [+U] -
regexp pattern production


fixed in rev32 draft