Skip to content

Treat the default regular expression syntax as being with the Unicode flag #958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brettz9 opened this issue Jul 11, 2020 · 0 comments
Closed

Comments

@brettz9
Copy link

brettz9 commented Jul 11, 2020

From #821 (apologies for commenting further there, as I had interpreted the issue as a general choice for the interpretation of the existing regular expression rule)

Though #32 seeks to add the ability to use flags, in order to ensure plain regular expressions are looking forward to future usage, I think, if feasible, and if not too late, it would be ideal to see the u flag enforced by default, including with property escapes.

There are a few reasons in my view:

  1. Besides offering new features, working with full code points, etc., certain syntax allowable without the flag will become no longer allowable, i.e., an unescaped { literal.
  2. The JavaScript community has mechanisms already for preferring the flag: https://eslint.org/docs/rules/require-unicode-regexp
  3. There is a massive amount of expressivity in regular expressions with the u flag (e.g., Unicode properties such as any Unicode letter with \p{Letter})

Some potential factors against:

  1. Level of adoption is not universal. https://caniuse.com/#search=unicode%20regex lists global adoption of the Unicode flag at 91.54% globally and the separate support for the powerful Unicode Property escapes support at 84.89%
  2. It might be seen as suggestive that without a flag mechanism, the default from JavaScript would be used--i.e., no flags, and therefore no Unicode flag.
@brettz9 brettz9 closed this as completed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant