Re: bug#60690: -P '\d' in GNU and git grep
- From
Paul Eggert <eggert@cs.ucla.edu>
- Date
- Apr 5, 2023, 20:03 UTC
- Message-ID
- <ed237a07-2f77-74eb-2f52-49b9b8f08873@cs.ucla.edu>
- In-Reply-To
- <CA+8g5KHYqgAZPpTOXWekDpWv-mvj-rBkGu+4MXy4OB1VDeS4Lw@mail.gmail.com>
On 2023-04-05 12:40, Jim Meyering wrote:
> (C) preserve grep -P's tradition of \d matching only 0..9, and once > grep uses 10.43 or newer, \b and \w will also work as desired.
If I understand you correctly, (C) would mean that GNU grep -P, git grep -P, and pcre2grep -u would all use PCRE2_UTF | PCRE2_UCP, and would also use the extra option PCRE2_EXTRA_ASCII_BSD that is planned for 10.43 PCRE2.
This would require changes to bleeding-edge pcre2grep -u (since it would need to add PCRE2_EXTRA_ASCII_BSD unless --no-ucp is also given), and to git grep -P (which would need to add PCRE2_UCP and PCRE2_EXTRA_ASCII_BSD, when libpcre2 is new enough to #define PCRE2_EXTRA_ASCII_BSD).
This option works for me as well. In fact it's the least work for me since I already implemented it in bleeding-edge GNU grep (so it works this way already :-).