[EMAIL PROTECTED] wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
> uname output: Linux kansas 2.4.18-26.7.x #1 Mon Feb 24 10:15:02 EST 2003 i686 
> unknown
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 3.2
> Patch Level: 0
> Release Status: release
> 
> Description:
>       A simple regexp match using =~ inside [[ ]] works on 3.0.16
>       and 3.1 versions of bash, but doesn't in 3.2.
> 
>       In pre-3.2 versions, the script in "Repeat-By" (below)
>       produces one line of output: "Dog 01 is Wiggles".  In 3.2, the
>       regexp no longer matches, so it produces nothing.
> 
> Repeat-By:
>       # run this, eh?
>       DOG="Dog name - 01 - Wiggles"
>       if [[ $DOG =~ "([[:alpha:][:blank:]]*)- ([[:digit:]]*) - (.*)$" ]]
>       then
>          echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
>       fi

One of the changes between bash-3.1 and bash-3.2 was to unify the handling
of the pattern in the `==' and `=~' conditional command operators.  Pattern
characters on the rhs are quoted to represent themselves (remove their
special pattern meaning).  This is how == has always worked.  If you remove
the double quotes and use backslashes to escape the spaces in the pattern,
you will get the match you want.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to