On 2007-04-25 at 15:33 +0100, Robert Rothenberg wrote: > In Bash 3.2, the syntax of regular expressions were changed. So > > if [[ $string =~ 'foo(.*)' ]] then ...
I like that =~ operator. In zsh, you zmodload zsh/pcre and then use the -pcre-match operator, thus: if [[ $string -pcre-match 'foo(.*)' ]]; then ... ; fi I like it so much, I just submitted a patch for zsh which introduces the =~ operator to autoload the PCRE module as required and then map to the -pcre-match operator. With this, the zsh support for regexps handles quoted or unquoted, as per bash prior to 3.2. Y'know, switching to The Other Shell is never one killer feature, it's all the neat stuff which taken together is just nicer. ObHate: zsh may be powerful but the extended syntax can sometimes make Perl JAPH hacks look like elegant models of clean design. -Phil