Re: How to use [[ string =~ regexp ]]?

2006-05-22 Thread Peter Volkov
On Вск, 2006-05-21 at 15:55 -0400, Paul Jarc wrote: > [a-z] matches only one charater, but the pattern is not required to > match against the entire string. On Вск, 2006-05-21 at 13:57 -0600, Mike Stroyan wrote: > The =~ regexp match will match a substring by default. You can use ^ and $ > to an

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Bob Proulx
Chet Ramey wrote: > It seems reasonable that quoting any part of the rhs to the =~ > operator should cause it to behave in the same manner. > > Since the arguments to [[ don't undergo any of the expansions that > require quoting to protect them, there's no reason for =~ to act > differently than t

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Chet Ramey
Bob Proulx wrote: > 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 [[

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Bob Proulx
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 operat

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Chet Ramey
Paul Jarc wrote: > Peter Volkov <[EMAIL PROTECTED]> wrote: >> $ [[ "string" =~ "[a-z]" ]] && echo something >> something > > [a-z] matches only one charater, but the pattern is not required to > match against the entire string. You can force it to match the whole > string by using "^" to anchor t

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Chet Ramey
Peter Volkov wrote: > Hello. > > Please CC my email to answers as I'm not subscribed to the list. > > I have problems using =~ operator. I've tried to search for answer, but > failed. I'm using GNU bash, version 3.1.17. Can anybody give me some > examples of usage? > > I really do not understand

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Mike Stroyan
On 5/21/06, Peter Volkov <[EMAIL PROTECTED]> wrote: I have problems using =~ operator. I've tried to search for answer, but failed. I'm using GNU bash, version 3.1.17. Can anybody give me some examples of usage? I really do not understand why $ [[ "string" =~ "[a-z]" ]] && echo something somet

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Paul Jarc
Peter Volkov <[EMAIL PROTECTED]> wrote: > $ [[ "string" =~ "[a-z]" ]] && echo something > something [a-z] matches only one charater, but the pattern is not required to match against the entire string. You can force it to match the whole string by using "^" to anchor the pattern to the beginning o

How to use [[ string =~ regexp ]]?

2006-05-21 Thread Peter Volkov
Hello. Please CC my email to answers as I'm not subscribed to the list. I have problems using =~ operator. I've tried to search for answer, but failed. I'm using GNU bash, version 3.1.17. Can anybody give me some examples of usage? I really do not understand why $ [[ "string" =~ "[a-z]" ]] && e