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:14:48 +0000 (GMT) [thread overview]
Message-ID: <20010321151448.4320.qmail@web9301.mail.yahoo.com> (raw)
In-Reply-To: <20010321142303.B8924@thelonious.new.ox.ac.uk>
--- Adam Spiers <adam@spiers.net> 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
next prev parent reply other threads:[~2001-03-21 15:15 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 [this message]
2001-03-21 16:01 ` Bart Schaefer
2001-03-21 15:47 ` Oliver Kiddle
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=20010321151448.4320.qmail@web9301.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).