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

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

Re: grep -e '\(a\)\1' -e '\(b\)\1'


From: Alain Magloire
Subject: Re: grep -e '\(a\)\1' -e '\(b\)\1'
Date: Sun, 18 Feb 2001 15:26:36 -0500 (EST)

Bonjour

> > > multiple -e arguments
> > > should be treated as independent patterns and back references
> > > should not refer to previous ones. 

There is a beta at :
ftp://alpha.gnu.org/gnu/grep/grep-2.5c.tar.gz

This is a beta __not__ for production use.

It's a first attempt to remedy.

> > > echo ba | egrep '(a)\1|(b)\1'
> > >
> > > doesn't print ba either.
> >
> > If you are sticking with POSIX.2, For ERE the expression is not
> > portable

> Agreed. I just find the behaviour in that case surprising:
> I'd expect it to match either both aa and ba, or a1 and b1.
> Apparently that only matches aa.

It will match "aaba".  The problem is that the first alternation
fails not setting the first group. In the second alternation the backref
will make the entire regex fail.

Now I do not know what POSIX.2 says about this.
In any case, I suspect the "fix" to be not trivial and a change unlikely.

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!




reply via email to

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