Closed
Description
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:
- 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. - The JavaScript community has mechanisms already for preferring the flag: https://eslint.org/docs/rules/require-unicode-regexp
- 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:
- 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%
- 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.
Metadata
Metadata
Assignees
Labels
No labels