@mathias Is it possible to write a short /u regex for ES IdentifierNames? My attempt:
/^(?=[$_\p{L}\p{Nl}\\])(?:[$_\p{L}\p{Nl}\u200c\u200d\p{Mn}\p{Mc}\p{Nd}\p{Pc}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+$/u
It’s missing edge cases like ℮ and ℘ though.
-
-
Oh my gosh, thank you! Why didn’t I think of that?
-
To clarify, it feels more “direct” because those are the Unicode properties the ECMAScript spec refers to these days. (Older versions of the spec referred to the more specific properties you were using, but it turns out that was unnecessarily complicated.) - 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.