Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Provide a shorthand for unicode-aware \w #22

Closed
DemiMarie opened this issue Feb 15, 2017 · 3 comments
Closed

Provide a shorthand for unicode-aware \w #22

DemiMarie opened this issue Feb 15, 2017 · 3 comments

Comments

@DemiMarie
Copy link

The Unicode-aware replacement for \w is very verbose and undiscoverable. There should be a shortcut syntax.

@mathiasbynens
Copy link
Member

mathiasbynens commented Feb 15, 2017

There was a pre-ES6 proposal to change the meaning of \w, \d, and \b in Unicode mode. It was ultimately rejected out of fear it would hurt adoption of the u flag.

We could reserve a shortcut of the form \p{Word} but that would cause a conflict if a property with that name is ever added to the Unicode Standard — something we cannot predict. We could make it \p{_Word} to make future collisions less likely but that’s kind of ugly.

It seems to me that the best we can do now is expose the primitives to let developers build equivalent regular expressions, which this proposal does.

@littledan
Copy link
Member

Maybe the right place to make this proposal would be at the Unicode level, to add such a property, cc @srl295 .

@mathiasbynens
Copy link
Member

Closing this issue as it’s not going to happen as part of this proposal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants