A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] Expand \d to include all unicode numbers

goatandsheep
2018-03-11

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?

simevidas
2018-03-12

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

Crissov
2018-03-12

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