Subject: Re: [BUG] quoting within bracket patterns has no effect
From: Mikael Magnusson <[email-masked]>
To: Peter Stephenson <[email-masked]>
Cc: "Zsh Hackers' List" <[email-masked]>
Date: Tue, 19 Jan 2016 17:25:58 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Tue, Jan 19, 2016 at 5:03 PM, Peter Stephenson
<[email-masked]> wrote:
> diff --git a/README b/README
> index 2e2ebce..8ec148e 100644
> --- a/README
> +++ b/README
> @@ -29,17 +29,43 @@ Zsh is a shell with lots of features.  For a list of some of these, see the
>  file FEATURES, and for the latest changes see NEWS.  For more
>  details, see the documentation.
>
> -Incompatibilities between 5.1 and 5.2
> +Incompatibilities between 5.2 and 5.3
>  -------------------------------------
>
> +In character classes delimited by "[" and "]" within patterns, whether
> +used for filename generation (globbing) or other forms of pattern
> +matching, it used not to be possible to quote "-" when used for a range,
> +or "^" and "!" when used for negating a character set.  The chracters can
> +now be quoted by any of the standard shell means, but note that
> +the "[" and "]" must not be quoted.  For example,
> +
> +  [[ $a = ['a-z'] ]]
> +
> +matches if the variable a contains just one of the characters "a", "-"
> +or "z" only.  Previously this would have matched any lower case ASCII
> +letter.  Note therefore the useful fact that
> +
> +  [[ $a = ["$cset"] ]]
> +
> +matches any chracter contained in the variable "cset".  A consequence
> +of this change is that variables that should have active ranges need
> +(with default zsh options) to be indicated explicitly, e.g.
> +
> +  cset="a-z"
> +  [[ b = [${~cset}] ]]
> +
> +The "~" causes the "-" character to be active.  In sh emulation the
> +"~" is unncessary in this example and double quotes must be used to
> +suppress the range behaviour of the "-".

Does this mean [$cset] and ["$cset"] work the same way in zsh
emulation, and [$cset] and [$~cset] work the same in sh emulation?
(character is also somewhat consistently typoed as chracters in two or
three places).

-- 
Mikael Magnusson