On Mon, Sep 26, 2011 at 07:06:30PM -0800, Roger wrote: > Some good reading I found is under the Bash Manual Page section "Parameter > Expansion". > > From here, to learn more about regex/regexpr as the Bash Manual is quite brief > on regex, use the following manual pages: > > perlretut - Gives a good from the start explanation of regular expressions, > including perl
Perl's regular expressions are not the same as Bash's. Bash uses standard POSIX Extended Regular Expressions (ERE). You can find formal documentation at http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04 Or see "man egrep", as egrep (or grep -E) also uses EREs. Or see any web page that discusses EREs. Avoid reading documentation from a different language (in this case Perl), because the features tend to change. Perl uses a feature set and syntax that have been retroactively dubbed Perl Compatible Regular Expressions (PCRE). They're superficially similar to EREs, but have a much broader range of features (extensions) that are not compatible and will not work in Bash.