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

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



Bruce Stephens wrote:

> 
> Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> writes:
> 
> > This doesn't clash with any existing syntax.  Obviously you need
> > EXTENDED_GLOB set.
> > 
> > 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:
> (#di)readme.
> 
> But my example is strained, I don't really suggest that it would be a
> good idea.

I completely agree, there is a whole new set of globbing options
on the horizon ;-)

About the `options for the whole path' thing (which I would like to
have, too): why not use a generic approach, like the `^' and `-' glob
modifiers, i.e. `(#i)' works on the current path component, probably
only up to the next `(#...)' and `(#/i)' works on this and all
following components (until switched off again).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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