Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
non-greedy matching?
- X-seq: zsh-users 3712
- From: Adam Spiers <adam@xxxxxxxxxx>
- To: zsh users mailing list <zsh-users@xxxxxxxxxxxxxx>
- Subject: non-greedy matching?
- Date: Wed, 21 Mar 2001 14:23:03 +0000
- Mail-followup-to: zsh users mailing list <zsh-users@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: Adam Spiers <adam@xxxxxxxxxx>
Sorry, I seem to be coming out with a lot of dumb questions recently.
In my quest to improve my zsh startup time, I noticed to my horror
that when I initially coded prompt_adam2_setup, I made it invoke perl
no less than three times. Eliminating one of them is fairly easy;
however the other two invocations are:
..... | perl -pe 's/%{.*?%}//g'
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.
Any ideas? The only alternatives I've come up with are:
foo=$(print -P "$prompt_string")
bar="${foo//^[[[0-9;]##m/}"
the string and then strip out ANSI escape sequences, or maybe to use
the (^(...)) extended glob somehow, but I haven't managed to get the
latter working.
It would be nice if zsh could do non-greedy though.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author