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