[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Matching regular expression with Ctrl-A in the middle

From: Shawn Bohrer
Subject: Matching regular expression with Ctrl-A in the middle
Date: Wed, 4 May 2011 10:23:20 -0500 (CDT)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic
uname output: Linux dev1 #1 SMP Mon Oct 18 23:57:44 UTC 
2010 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.1
Patch Level: 7
Release Status: release


I have a regular expression with a Ctrl-A character in the middle and I
can no longer get it to match with bash 4.1.7.  However I can get
regular expressions to match as long as the Ctrl-A is at the beginning
or end of the regular expression so I suspect this is a bug.

Using 'shopt -s compat31' does allow the match to occur with a Ctrl-A in
the middle but I'd prefer to not use this if I don't have to.


-bash-4.1$ [[ "helloworld" =~ llo ]] && echo match
-bash-4.1$ [[ "helloworld" =~ world ]] && echo match
-bash-4.1$ [[ "helloworld" =~ world$ ]] && echo match
-bash-4.1$ [[ "helloworld" =~  ]] && echo match
-bash-4.1$ [[ "helloworld" =~ oworld$ ]] && echo match
-bash-4.1$ shopt -s compat31
-bash-4.1$ [[ "helloworld" =~ oworld$ ]] && echo match

reply via email to

[Prev in Thread] Current Thread [Next in Thread]