@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.
-
-
If you have the time, would it make sense to update https://mathiasbynens.be/notes/javascript-identifiers … to mention the “modern” way of doing it?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.
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.)