Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-greedy matching?
- X-seq: zsh-users 3714
- 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:14:48 +0000 (GMT)
- In-reply-to: <20010321142303.B8924@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- Adam Spiers <adam@xxxxxxxxxx> wrote:
> however the other two invocations are:
>
> ..... | perl -pe 's/%{.*?%}//g'
Does this do what you want:
... | sed 's/%{[^}]*%}//g'
It works here unless for some reason you have a closing curly bracket
in your escape sequence - assuming I've not missed something else. It
is fairly common to do [^..]* instead of .* when avoiding the effects
of greedy matching. What does the ? achieve in your perl regex?
It's a pity the col program isn't more powerful.
> 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
I haven't looked at your prompt function but you might also consider
checking if you can get what you want with the ternary expression in
the prompt expansion as it can check how many characters have been
printed on the current line.
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