Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why zsh chose to be non-compliant in pattern matching



On Mon, 29 Feb 2016 17:00:28 +0700
Cuong Manh Le <cuong.manhle.vn@xxxxxxxxx> wrote:
> The super user in U&L site post his opinion at
> http://unix.stackexchange.com/a/266394/38906
> 
> He said that the pattern matching spec is unspecified for quoted characters
> inside bracket expression. What is your opinion?

He's talking about the standard, which indeed doesn't say anything about
the subject.

[
    If an open bracket introduces a bracket expression as in XBD RE
    Bracket Expression, except that the <exclamation-mark> character (
    '!' ) shall replace the <circumflex> character ( '^' ) in its role
    in a non-matching list in the regular expression notation, it shall
    introduce a pattern bracket expression. A bracket expression
    starting with an unquoted <circumflex> character produces
    unspecified results. Otherwise, '[' shall match the character
    itself.

There's a reference there to regular expressions, for which only
backslash quoting is valid, as far as I'm aware.  Zsh has supported
that for quite a while.

I think it's more a question of current practice.  It's probably
widespread enough now to be standardisable.

pws



Messages sorted by: Reverse Date, Date, Thread, Author