Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-greedy matching?
- X-seq: zsh-workers 13690
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: non-greedy matching?
- Date: Wed, 21 Mar 2001 16:02:31 +0000
- In-reply-to: Your message of "Wed, 21 Mar 2001 15:52:39 GMT." <Tc0a88d01526e534d4a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
> % foo='%{one%}hello%{two%}'
> % print ${(S)foo//[%]\{*[%]\}}
> hello
>
> Don't ask me why you need to put the `%' in square brackets --- there may
> be some stray (s)printf in the code, for example. (Do tell me if you know
> what it is.)
I just realised: //% means match only at the end.
% print ${(S)foo//\\%\{*[%]\}}
also works. I always loathed that syntax: it's unmemorable and hacky (all
right, it's not on its own).
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author