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

Re: PATCH: 3.1.5 - (Sven) Case-insensitive globbing

Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> writes:

> This doesn't clash with any existing syntax.  Obviously you need
> Syntax 1       Syntax 2
> (#ifoo)bar     ((#i)foo)bar    match FOObar FoObar fOobar, not FOOBAR
> bar(#ifoo)     bar(#i)foo      same with the bits the other way round
> (#lfooBAR)     (#l)fooBAR      match FOOBAR FoOBAR fOoBAR, not foobar
> (#ifoo(#cbar)) (#i)foo(#c)bar  same as first example; #c negates i or l
> So in the first case, only the #X is the flag and grouping is normal,
> while in the second case the whole of (#X) is the flag and doesn't
> mark a separate group.  In both cases the effect stays until the end
> of the nearest enclosing group.
> #s (for significant) could be an alternative to #c; #l corresponds to
> Sven's (f) qualifier, i.e. only lower case letters in the pattern
> match case-insensitively in the target string.
> I think I find the second version (which is also more perl-like) a
> bit cleaner.

I prefer the second versions too.  What would really make it
compelling, of course, would be other flags that you might want to use
(when the first syntax could get tricky and ambiguous).  

I can only think of one candidate at present: ignore dots.  #d, say.
Then, a single pattern could match README, READ.ME, Read.Me and so on:

But my example is strained, I don't really suggest that it would be a
good idea.

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