[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use [[ string =~ regexp ]]?
From: |
Bob Proulx |
Subject: |
Re: How to use [[ string =~ regexp ]]? |
Date: |
Sun, 21 May 2006 20:03:57 -0600 |
User-agent: |
Mutt/1.5.9i |
Chet Ramey wrote:
> Peter Volkov wrote:
> > Please CC my email to answers as I'm not subscribed to the list.
> > $ [[ "string" =~ "[a-z]" ]] && echo something
> > something
> ...
> The real question is whether or not quoting the pattern should work as
> it does with other [[ pattern matching operators, which is to quote any
> characters special to the matching engine. I think it should, for
> consistency.
Could you give an example of how you think it should work? (Just
curious and trying to keep up.)
Are you thinking that this should match:
[[ "string" =~ [a-z] ]] && echo matched || echo not matched
Which this should not match?
[[ "string" =~ "[a-z]" ]] && echo matched || echo not matched
Thanks
Bob