[Proposal] Expand \d to include all unicode numbers

i18n
Tags: #<Tag:0x00007f8c11d39c40>

#1

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?


#2

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


#3

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….