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

Re: backreferences



On Fri, 16 Oct 2015 06:11:16 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> As a sidenote, (^foo)* is always useless to write, since (^foo) will
> expand to the empty string, and then the * will consume anything else.
> A useful way to think of (^foo) is a * that will exclude any matches
> that don't match the pattern foo.

The warnings about the dangers of pattern matching elsewhere are
useful, though it's perhaps worth pointing out here that if what you
mean is a string of three characters that are not the characters f, o,
o, zsh allows you to do exactly this:

  (???~foo)

pws



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