From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19119 invoked from network); 21 Mar 2001 15:15:04 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Mar 2001 15:15:04 -0000 Received: (qmail 20319 invoked by alias); 21 Mar 2001 15:14:49 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3714 Received: (qmail 20308 invoked from network); 21 Mar 2001 15:14:48 -0000 Message-ID: <20010321151448.4320.qmail@web9301.mail.yahoo.com> Date: Wed, 21 Mar 2001 15:14:48 +0000 (GMT) From: =?iso-8859-1?q?Oliver=20Kiddle?= Subject: Re: non-greedy matching? To: Adam Spiers , zsh users mailing list In-Reply-To: <20010321142303.B8924@thelonious.new.ox.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit --- Adam Spiers 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