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

Re: 'case' pattern matching bug with bracket expressions



On 5/14/15 10:42 AM, Peter Stephenson wrote:

> This is the pattern:
>  '['                   introducing bracketed expression
>    '] | *[!a-z'        characters inside
>  ']'                   end of bracketed expression
>  '*'                   wildcard.
> 
> so it's a set including the character a followed by anything, and hence
> matches.
> 
> I'm not really sure we *can* resolve this unambiguously the way you
> want.  Is there something that forbids us from interpreting the pattern
> that way?  

Look at the Posix grammar.  A case pattern list is a sequence of one
or more WORDs separated by (zero or more) `|'s.  WORDs are delimited by
metacharacters and cannot contain unquoted blanks.  The `[]' is a
separate WORD delimited by a space.

The rules governing how the pattern is treated only come into play
after the command is parsed.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/



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