Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-greedy matching?
- X-seq: zsh-workers 13689
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: non-greedy matching?
- Date: Wed, 21 Mar 2001 15:52:39 +0000
- In-reply-to: Your message of "Wed, 21 Mar 2001 14:23:03 GMT." <20010321142303.B8924@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Adam Spiers <adam@xxxxxxxxxx> wrote:
> They are done in order to strip control characters from a prompt so
> that its display width can be determined. At first I thought that it
> would surely be easy to avoid this, but I still haven't come up with a
> quick replacement, since neither zsh nor sed seem to be able to do
> non-greedy matching.
You can, it's in the manual.
% 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.)
--
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