[Top][All Lists]

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

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

From: Peter Volkov
Subject: Re: How to use [[ string =~ regexp ]]?
Date: Mon, 22 May 2006 15:58:38 +0400

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 anchor the expression to the start and end of the string.

Yes! That was what I missed.

On Вск, 2006-05-21 at 22:40 -0400, 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 the other operators that do pattern matching.

Never noticed that. This is really interesting.

Thank you all for your answers,

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

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