[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5 Basic vs Extended

In basic regular expressions the metacharacters `?', `+', `{', `|', `(', and `)' lose their special meaning; instead use the backslashed versions `\?', `\+', `\{', `\|', `\(', and `\)'.

Traditional egrep did not support the `{' metacharacter, and some egrep implementations support `\{' instead, so portable scripts should avoid `{' in `egrep' patterns and should use `[{]' to match a literal `{'.

GNU egrep attempts to support traditional usage by assuming that `{' is not special if it would be the start of an invalid interval specification. For example, the shell command `egrep '{1'' searches for the two-character string `{1' instead of reporting a syntax error in the regular expression. POSIX.2 allows this behavior as an extension, but portable scripts should avoid it.



This document was generated on June, 8 2003 using texi2html