bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: GNU grep 2.5: case-insensitive backreference bug


From: Stepan Kasal
Subject: Re: GNU grep 2.5: case-insensitive backreference bug
Date: Thu, 25 Jul 2002 11:19:48 +0000 (UTC)
User-agent: slrn/0.9.6.2 (Linux)

Hello,

On Mon, 22 Jul 2002 07:20:23 -0700, Troy Bridoux <address@hidden> wrote:
> GNU grep 2.5
> 
> Combining case-insensitivity with backreferences generates what looks
> like a bug to me:

the reason of this problem is that the regex library haven't proper
interface to specify that we want case insensitive matching.

Fortunately, the regex implementation in newest glibc CVS fixes this.
(It was written by Isamu Hasegawa from IBM Japan, as far as I know.)

grep should use this newest library.  I hope to post a fix in a week
or two.

> 2) Grep possible correct behavior #1
... 
> % echo "aa" | grep -i '\(A\)\1'
> aa
> % echo "Aa" | grep -i '\(A\)\1'
> % echo "aA" | grep -i '\(A\)\1'
... 
> 3) Grep possible correct behavior #2; also Perl current behavior
... 
> % echo "aa" | perl -ne 'print if /(A)\1/i'
> aa
> % echo "Aa" | perl -ne 'print if /(A)\1/i'
> Aa
> % echo "aA" | perl -ne 'print if /(A)\1/i'
> aA
> 
> For consistency with a popular tool which is becoming the defacto
> standard on regular expressions, I would personally prefer the latter
> behavior to be adopted.

I'd personally prefer the former, but I'll accept the behaviour
implemented in the regex library mentioned above.

BTW: GNU grep (at least version 2.5 and above) has support for perl
compatible regexps.  It's activated by option -P.
(You have to have pcre library installed.)

Thank you very much for your bug report,
        Stepan Kasal





reply via email to

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