On Fri, 09 Mar 2007 11:39:18 -0500 Chet Ramey <[EMAIL PROTECTED]> wrote:
> Kevin F. Quinn wrote: > > On Mon, 5 Mar 2007 17:49:47 -0500 > > Chet Ramey <[EMAIL PROTECTED]> wrote: > > > >> Bash-Release: 3.2 > >> Patch-ID: bash32-010 > > > > I'm still seeing a difference in behaviour: > > Yes. That's the difference between the undefined quoting semantics > in bash-3.1 and the defined semantics in bash-3.2. In bash-3.2, the > quoting removes all meaning from any characters special to the regular > expression engine. > > > > > To get the 3.2 results, I expected to have to write: > > > > [[ ${v} =~ "\^Alpha" ]] && echo match 4 || echo no match 4 > > [[ ${v} =~ '\^Alpha' ]] && echo match 5 || echo no match 5 > > Why? I guess I've gotten into the habit of putting any text string in double-quotes to avoid having to quote things like spaces, or single-quotes to avoid having to quote $ as well. Actually, I didn't expect to _have_ to write it like that, just that it would be possible; e.g. that the following would be equivalent: \^Alpha\ Beta "\^Alpha Beta" '^Alpha Beta' (thinking now that perhaps ^ would lose its special meaning in '') in order to match the literal string `^Alpha Beta' - i.e. without special meaning to ^. > The 3.2 behavior means that the match is performed on the > literal string `\^Alpha', with the backslash and circumflex quoted to > protect them from interpretation by the regexp matching engine. > That's the difference. So effectively, the new rule is that all the regex special characters lose their special meaning when placed in double or single quotes (much like '$' does inside single quotes). Thanks for the clarification. -- Kevin F. Quinn
signature.asc
Description: PGP signature
_______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash