[Proposal] Expand \d to include all unicode numbers

With the push for supporting international languages, we need to allow Javascript to reflect this expansion. In regex, if we already have [0-9] for all ASCII numbers, why can’t \d match everything on the list of Unicode numbers?

This is relevant, I think: ECMAScript now supports Unicode property escapes in regular expressions.

To match any decimal number in Unicode rather than just ASCII [0-9], use \p{Decimal_Number} instead of \d as per UTS18.

Source: https://github.com/tc39/proposal-regexp-unicode-property-escapes#unicode-aware-version-of-d

4 Likes

ECMAscript will also make this available as \p{Nd} but not \pNd, while elsewhere it is written [:Decimal_Number:] or [:Nd:]. As usual, \P… is the inverse of \p….

2 Likes