escaping - in /u RegExp

# Allen Wirfs-Brock (10 years ago)

Would those of you who consider yourselves RegExp experts take a look at ecmascript#3519 Is this a bug? If so, what is the fix?

This construction for Identity Escape goes back to Norbert's original proposal

Perhaps we need to add a:

ClassAttom[U] :: [+U]  \-

production or some such to the pattern grammar.

# Gary Guo (10 years ago)

I think it s a bug, and I think your proposal is appropriate.

# Mathias Bynens (10 years ago)

I think it’s a bug — see codereview.chromium.org/788043005/diff/220001/src/parser.cc#newcode4354 for the discussion that led to this report.

Your change would allow developers to use an escaped - in a character class, e.g. /[a-f\-A-Z]/u, rather than having to move it to the beginning (i.e. /[-a-fA-Z]/u or end (/[a-fA-Z-]/u) of the character class, as is possible today without the u flag. That is a good thing IMHO.

# Norbert Lindenberg (10 years ago)

I think the change proposed by Allen is fine. The main point of the new definition of IdentityEscape is to reserve \p, \X, and other escape sequences involving ASCII letters, to which we may want to assign different interpretations in the future. Allowing - does not conflict with this.

# Allen Wirfs-Brock (10 years ago)

actually it looks to be like a better place to put it is:

ClassEscape[U] :: [+U] -