Re: bug#60690: -P '\d' in GNU and git grep
- From
Paul Eggert <eggert@cs.ucla.edu>
- Date
- Apr 8, 2023, 22:45 UTC
- Message-ID
- <43d04851-2463-2922-44e3-075080129ec3@cs.ucla.edu>
- In-Reply-To
- <CAPUEspjtN-cwm=Nn=hMCcbOcOgPaVHsBfLW9TXn1HZrxtRR3BQ@mail.gmail.com>
On 2023-04-07 22:01, Carlo Arenas wrote:
> Not sure I follow the whole logic here, but PCRE2[3] (search for > "general category" which is what the "gc" above stands for) only > supports the abbreviated form of the unicode classes and `Nd` is > indeed the one that corresponds to `Decimal_Number`.
That's fine: all that UTS#18[1] requires is that PCRE2 provide syntax for a regular expression that matches the Decimal Number class. Which PCRE2 does, via \p{Nd}.
The logic is that UTF#18 does not require that \d must behave like \p{Nd}, or even that \p{gc=Decimal_Number} must behave like \p{Nd}. It merely requires that there be some syntax for matching Decimal Number, and it says the choice of syntax is up to the implementer. This is why UTF#18 doesn't require that \d must also match non-ASCII digits (which is what I think Yves was saying).
[1]: https://unicode.org/reports/tr18/