From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16769 invoked from network); 11 Oct 2006 13:31:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Oct 2006 13:31:50 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 69840 invoked from network); 11 Oct 2006 13:31:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 13:31:44 -0000 Received: (qmail 19387 invoked by alias); 11 Oct 2006 13:31:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10828 Received: (qmail 19378 invoked from network); 11 Oct 2006 13:31:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Oct 2006 13:31:35 -0000 Received: (qmail 68747 invoked from network); 11 Oct 2006 13:31:35 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 13:31:31 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly18c.srv.mailcontrol.com (MailControl) with ESMTP id k9BDRp9S001016 for ; Wed, 11 Oct 2006 14:31:16 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Wed, 11 Oct 2006 14:29:09 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.7/8.13.4) with ESMTP id k9BDT9x1028242 for ; Wed, 11 Oct 2006 14:29:09 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.7/8.13.7/Submit) with ESMTP id k9BDT7dW028239 for ; Wed, 11 Oct 2006 14:29:09 +0100 Message-Id: <200610111329.k9BDT7dW028239@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-users@sunsite.dk Subject: Re: pattern matching question In-reply-to: <20061011131505.GA4262@fsst.voodoo.lan> References: <20061011130213.GA6307@localhost.localdomain> <20061011131505.GA4262@fsst.voodoo.lan> Comments: In-reply-to Frank Terbeck message dated "Wed, 11 Oct 2006 15:15:05 +0200." Date: Wed, 11 Oct 2006 14:29:06 +0100 From: Peter Stephenson X-OriginalArrivalTime: 11 Oct 2006 13:29:09.0143 (UTC) FILETIME=[3B5BD270:01C6ED39] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-04-02 (www.mailcontrol.com) on 10.67.0.128 Frank Terbeck wrote: > list=("... one giraffe ..." "... two cows ..." "... one monkey ..." "... thre > e lemmings ...") > slist=(${(M)list:#*one [a-z]*}) To get the exact effect arno wants, you need an additional substitution to remove the extra stuff, which brings it back to his original proposal. I'd probably just do the simple slist=(${${${(M)list:#*one [a-z]*}##*one }%% *}) which now has two extra pattern matches. I can't offhand think of a way of both matching the one and extracting the following word in one go. In practice it's unlikely to make a noticeable difference unless you're really doing this a great deal---and if speed's that important it's probably time to switch to a more optimized scripting language. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php