git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bug#60690: -P '\d' in GNU and git grep

From
Carlo Arenas <carenas@gmail.com>
Date
Apr 8, 2023, 05:01 UTC
Message-ID
<CAPUEspjtN-cwm=Nn=hMCcbOcOgPaVHsBfLW9TXn1HZrxtRR3BQ@mail.gmail.com>
In-Reply-To
<065bcdcb-5770-5384-5afe-4a4d29272274@cs.ucla.edu>
On Fri, Apr 7, 2023 at 12:00 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
Show 23 quoted lines
>
> On 2023-04-06 06:39, demerphq wrote:
>
> > Unicode specifies that \d match any digit
> > in any script that it supports.
>
> "Specifies" is too strong. The Unicode Regular Expressions technical
> standard (UTS#18) mentions \d only in Annex C[1], next to the word
> "digit" in a column labeled "Property" (even though \d is really syntax
> not a property). This is at best an informal recommendation, not a
> requirement, as UTS#18 0.2[2] says that UTS#18's syntax is only for
> illustration and that although it's similar to Perl's, the two syntax
> forms may not be exactly the same. So we can't look to UTS#18 for a
> definitive way out of the \d mess, as the Unicode folks specifically
> delegated matters to us.
>
> Even ignoring the \d issue the digit situation is messy. UTS#18 Annex C
> says "\p{gc=Decimal_Number}" is the standard recommended syntax
> assignment for digits. However, PCRE2 does not support this syntax; it
> supports another variant \p{Nd} that UTS#18 also recommends. So it
> appears that PCRE2 already does not implement every recommended aspect
> of UTS#18 syntax. PCRE2 also doesn't match Perl, which does support
> "\p{gc=Decimal_Number}".

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

Carlo

[1]: https://unicode.org/reports/tr18/#Compatibility_Properties [2]: https://unicode.org/reports/tr18/#Conformance [3]: https://pcre2project.github.io/pcre2/doc/html/pcre2pattern.html

Previous: Paul EggertNext: Paul Eggert
Message 18 of 19 in “-P '\d' in GNU and git grep”
  1. Paul EggertApr 3, 2023
  2. Jim MeyeringApr 4, 2023
  3. Paul EggertApr 4, 2023
  4. Jim MeyeringApr 4, 2023
  5. Carlo ArenasApr 4, 2023
  6. Paul EggertApr 4, 2023
  7. Junio C HamanoApr 4, 2023
  8. Paul EggertApr 5, 2023
  9. Paul EggertApr 5, 2023
  10. Junio C HamanoApr 5, 2023
  11. Jim MeyeringApr 5, 2023
  12. Paul EggertApr 5, 2023
  13. Carlo ArenasApr 5, 2023
  14. demerphqApr 6, 2023
  15. Paul EggertApr 7, 2023
  16. demerphqApr 6, 2023
  17. Paul EggertApr 7, 2023
  18. Carlo ArenasApr 8, 2023
  19. Paul EggertApr 8, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.