Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-greedy matching?
- X-seq: zsh-users 3715
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Adam Spiers <adam@xxxxxxxxxx>, zsh users mailing list <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: non-greedy matching?
- Date: Wed, 21 Mar 2001 15:47:14 +0000 (GMT)
- In-reply-to: <20010321142303.B8924@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- Adam Spiers <adam@xxxxxxxxxx> wrote:
> Any ideas? The only alternatives I've come up with are:
>
> foo=$(print -P "$prompt_string")
> bar="${foo//^[[[0-9;]##m/}"
I should have thought about this before replying the first time but I
didn't until after Sven's e-mail. If you have extendedglob set, you can
do:
${(%%)${PS1//%\{(^*%\}*)%\}/}}
Doing the replace before the prompt expansion allows this to match the
%{...%} instead of the escape sequence. If you have any parameters
which when substituted include escape sequences, you may need to use
(e) before PS1 to expand these first. I trust this more than the sed
because it can do (^*%\}*) which matches anything which doesn't contain
%} to force the non-greedy behaviour.
Oliver
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author