Bill Gradwohl wrote:
> [email protected] wrote:
> > For grep, you need '^[[:alpha:]]\+'.
>
> That backslash did it.
> 
> Now I'm going into the docs to find where it says I need a backslash for
> the + but nothing for the *.

It starts with this part:

    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 implementations,
    basic regular expressions are less powerful.  The following description
    applies to extended regular expressions; differences for basic regular
    expressions are summarized afterwards.

'grep' handles basic regular expressions.  'egrep' is the old name for
'grep -E' and it handles extended regular expressions.  * is a basic
regular expression and + is an extended regular expression.

GNU grep handles both in a compatible way.  If you call 'grep' then it
handles the basic regular expressions like * and also the extended
expressions if the extended one is escaped.

If you call it with 'grep' then you should use the basic syntax.  But
the extended is available if it is escaped.

  grep    '^[[:alpha:]]\+'

If you call it with -E then you get the full extended syntax.

  grep -E '^[[:alpha:]]+'

Bob

Reply via email to