From: "Oliver Kiddle" <okiddle@yahoo.co.uk>
To: Adam Spiers <adam@spiers.net>,
zsh users mailing list <zsh-users@sunsite.auc.dk>
Subject: Re: non-greedy matching?
Date: Wed, 21 Mar 2001 15:47:14 +0000 (GMT) [thread overview]
Message-ID: <20010321154714.31702.qmail@web9305.mail.yahoo.com> (raw)
In-Reply-To: <20010321142303.B8924@thelonious.new.ox.ac.uk>
--- Adam Spiers <adam@spiers.net> 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
next prev parent reply other threads:[~2001-03-21 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2001-03-21 14:57 Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010321154714.31702.qmail@web9305.mail.yahoo.com \
--to=okiddle@yahoo.co.uk \
--cc=adam@spiers.net \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).