Closed mathiasbynens closed 7 years ago
They won’t be in this case1:
An alternative possibility would be to only allow named capture groups in Unicode RegExps, to avoid the hazard of a user thinking they had support but not realizing that backreferences were not permitted.
With u
there is no confusion.
1 I’m strongly in favor of the above option, by the way. New syntactical features should only apply to Unicode RegExps. Not using u
for new regular expressions is like using var
instead of const
or let
.
I added /u
to the code samples in a separate patch; sorry for forgetting about this and not just merging it. It's best practices to use /u
anyway. We're discussing the optionality of /u
in https://github.com/tc39/proposal-regexp-named-groups/issues/7 .
I think these samples are valid without /u. What is the purpose of adding it?