grep-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible regression in grep 3.10


From: Paul Eggert
Subject: Re: Possible regression in grep 3.10
Date: Sun, 2 Apr 2023 11:20:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 2023-04-02 00:00, arnold@skeeve.com wrote:
Maybe it's time to drop PCRE support from grep?

I doubt whether we could do that - it's a big change and I expect too many users depend on -P.

However, I still have qualms about the recent -P '\d' business, as \d currently means something different with grep -P than it does in Perl - or in Python and Java, for that matter.

The \d vs [0-9] issue has long been a source of trouble. See, for example the circa 2009 <https://stackoverflow.com/questions/890686/should-i-use-d-or-0-9-to-match-digits-in-a-perl-regex>. That being said, Grep's current disagreement with Perl on this issue smells like even more trouble, as the Perl community has long settled on \d matching non-ASCII decimal digits, despite well-known issues with that <https://perldoc.perl.org/perlrecharclass#Digits>.

There's no perfect solution here. All things considered, though, perhaps it'd be better to go back to grep 3.9's behavior, which matches Perl's. Proposed patch attached. I have tested this with Ubuntu 22.10 but not with bleeding-edge PCRE2.

Attachment: 0001-grep-go-back-to-3.9-P-d-behavior.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]