zsh-users
 help / color / mirror / code / Atom feed
* Re: non-greedy matching?
@ 2001-03-21 14:57 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2001-03-21 14:57 UTC (permalink / raw)
  To: zsh-users


Adam Spiers wrote:

> ...
> 
> Any ideas? 

No (I'm still worried about what I wrote in the other mail to
-workers), but:

> The only alternatives I've come up with are:
> 
>   foo=$(print -P "$prompt_string")

No need for that extra sub-shell there, use ${(%):-$prompt_string} or
${(%%):-...} depending on what you want...


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 5+ messages in thread
* non-greedy matching?
@ 2001-03-21 14:23 Adam Spiers
  2001-03-21 15:14 ` Oliver Kiddle
  2001-03-21 15:47 ` Oliver Kiddle
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Spiers @ 2001-03-21 14:23 UTC (permalink / raw)
  To: zsh users mailing list

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-03-21 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-21 14:57 non-greedy matching? Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2001-03-21 14:23 Adam Spiers
2001-03-21 15:14 ` Oliver Kiddle
2001-03-21 16:01   ` Bart Schaefer
2001-03-21 15:47 ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).