[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Egrep does not support \A, \Z, \s
From: |
Karl Berry |
Subject: |
Re: Egrep does not support \A, \Z, \s |
Date: |
Sat, 2 Jul 2005 13:01:32 -0400 |
Thus your regepxs are malformed.
Well, that seems a bit draconian. POSIX is not the be-all and end-all
of what is ok. As I know you know, Andreas, GNU has always supported
many useful extensions, not to mention every other real-world program.
That POSIX does not live in the real world does not obviate the fact
that we do :).
> echo "hi" | egrep "\Ah"
> echo "hi | egrep "i\Z"
> echo "h i" | egrep "\s"
However, in this case, I surmise you were expecting the Perl definitions
for \A, \Z, and \s. These have never been supported by GNU (e)grep (or
any other GNU program that I can think of). GNU grep relatively
recently acquired a --perl-regexp option to interpret regexps as Perl,
but I gather the support is rather flaky. If you want Perl regexps, I
advise using Perl.
The comparable GNU extensions are \< and \> for \A and \Z. And the
standard [[:space:]] is comparable to \s.
BTW, using \ inside "double quotes" on the command line is risky,
because shells also interpret some \-sequences . Better to use
'single quotes'.
Regards,
Karl