bug-grep
[Top][All Lists]
Advanced

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

Re: Erroneous claim in grep man page


From: Francis Litterio
Subject: Re: Erroneous claim in grep man page
Date: Fri, 08 Aug 2008 12:05:19 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (windows-nt)

Tony Abou-Assaleh wrote:

> On Fri, 8 Aug 2008, Francis Litterio wrote:
>
>> The grep/egrep man page says this:
>>
>>   Grep understands two different versions of regular expression syntax:
>>   "basic" and "extended."  In GNU grep, there is no difference in
>>   available functionality using either syntax.  In other implementa-
>>   tions, basic regular expressions are less powerful.
>>
>> But I see this behavior with grep 2.5.1:
>>
>>      $ echo foobar | grep 'fo+bar'
>>      $ echo foobar | egrep 'fo+bar'
>>      foobar
>>
>> So the claim in the man page that "there is no difference in available
>> functionality using either syntax", doesn't seem to be true.
>
> Francis,
>
> The main difference between basic and extended regular expressions in GNU
> grep is that only . and * have a special meaning in basic regular
> expression, all other characters must be escaped before they become
> special.

OK.  I think I get it.  The man page is saying that while grep and egrep
have the same _functionality_, they use different _syntax_ to achieve
that functionality:

        $ echo foobar | grep 'fo\{2\}bar'
        foobar
        $ echo foobar | egrep 'fo{2}bar'
        foobar

Correct?

I would maintain that the man page's phrasing is somewhat confusing.
--
Fran





reply via email to

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