This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash regular expressions


I tried:
[[ abc =~ a.*c ]] && echo It works
It doesn't work too.
I did't try bash from gnu.org yet but debian bash (version 3.1.0(1)) works with and without quotes.

Boris

Eric Blake wrote:
According to Boris Toloknov on 12/19/2006 1:45 PM:
It seems that regular expressions [[ str =~ regex ]] do not work in bash.
For example the following expression doesn't match:
[[ abc =~ 'a.*c' ]] && echo It works

In bash 3.2, the [[ ]] quoting rules changed slightly. Since [[ already introduces special quoting rules, single quotes are not required; the regex is already protected by the shell from globbing. Try this instead:

[[ abc =~ a.*c ]] && echo It works

And since none of this is cygwin specific, you should report this upstream
to bug-bash AT gnu DOT org if you think it is a bug.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]