> > Description:
> >        [[ ... =~ ... ]] is broken when RHS is quoted
> 
> from http://tiswww.case.edu/php/chet/bash/CHANGES :
> 
> f.  Quoting the string argument to the [[ command's  =~ operator now forces
>     string matching, as with the other pattern-matching operators.

Hmmm ... ok, thanks, I did miss that. While I think that that is
reasonably clear, I think the man page is not:

        Word splitting and pathname expansion are not performed on
        the words  between  the  [[  and     ]];  tilde expansion,
        parameter  and variable expansion, arithmetic expansion,
        command substitution, process substitution, and quote removal
        are performed.                                  ^^^^^^^^^^^^^

"Quote removal" means that, as usual, quotes do not form part of the
arguments, they merely serve to delimit the arguments, I take it.
"Words between [[ and ]] ... quote removal performed" means on *all*
words between [[ and ]] I take it. Hmm ...  No, that can't be right
otherwise

        bash -c '[[ "apple" =~ "(apple)" ]]; echo ${BASH_REMATCH[1]}'

would say apple. Hmmm ... while the CHANGES file indicates that I
was wrong that bash is broken, I would say that bash is broken
*w.r.t. the behaviour documented in its man page*. What do you think?

Alexis


Reply via email to