2012/3/27 Steven Levithan <[email protected]>:
> The idea for /u and the following aspects of it already seem to have some
> consensus:
>
> - Switch from code unit to code point matching.
> - Make \d\w\b Unicode-aware.
I think we should leave these alone. They are concise and useful and
will continue to be so when /u is the default in Harmony code.
Instead we should introduce \p{...} immediately which provides the
same functionality.
> - Make /i use proper Unicode casefolding.
> - Enable \u{x..} (break from web reality).
Make unpaired surrogates in /u regexps a syntax error.
Add /U to mean old-style regexp literals in Harmony code (analogous to
/s and /S which have opposite meanings).
> Since /u may be a one-time opportunity to broadly change RegExp semantics,
> how about adding another change on the pile?
>
> - Break from web reality for escaped A-Z and a-z. Throw a SyntaxError when
> any letter not assigned a special meaning is escaped, instead of matching
> the literal character.
>
> I.e., /\i/u etc. must throw a SyntaxError.
Yes.
Also we should consider the Perl syntax that allows you to switch on
and off flags for only part of a regexp, so that case independence
does not have to apply to the whole regexp.
> This is relevant to future Unicode support, because without breaking web
> reality we might never be able to add \p{..} and \P{..} for Unicode
> properties, \X for graphemes, \N{..} for named characters, etc.
>
> Of course, this change would also make it easier to add any from a host of
> special escapes in other regex libraries (such as \k<..> for named
> backreferences) or new ES inventions. It's really ugly that such features
> might not be able to be added by default everywhere, but them's the breaks,
> I suppose (I hope I'm wrong).
>
> We could go crazy and start fixing all of ES's RegExp warts when /u is
> applied, even though such changes would not be related to Unicode support.
> I'd be happy to pursue that, but I suspect many here would see it as a
> bridge too far.
>
> Thoughts?
>
>
> -- Steven Levithan
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss