From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19612 invoked from network); 21 Mar 2001 15:53:17 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Mar 2001 15:53:17 -0000 Received: (qmail 520 invoked by alias); 21 Mar 2001 15:53:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13689 Received: (qmail 502 invoked from network); 21 Mar 2001 15:53:06 -0000 Message-ID: To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: non-greedy matching? In-Reply-To: Your message of "Wed, 21 Mar 2001 14:23:03 GMT." <20010321142303.B8924@thelonious.new.ox.ac.uk> Date: Wed, 21 Mar 2001 15:52:39 +0000 From: Peter Stephenson Adam Spiers wrote: > 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. You can, it's in the manual. % foo='%{one%}hello%{two%}' % print ${(S)foo//[%]\{*[%]\}} hello Don't ask me why you need to put the `%' in square brackets --- there may be some stray (s)printf in the code, for example. (Do tell me if you know what it is.) -- Peter Stephenson Software Engineer CSR Ltd., Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070