From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 838 invoked from network); 11 Oct 2006 14:09:25 -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.5 required=5.0 tests=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 14:09:25 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33908 invoked from network); 11 Oct 2006 14:09:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 14:09:19 -0000 Received: (qmail 27316 invoked by alias); 11 Oct 2006 14:09:07 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10829 Received: (qmail 27305 invoked from network); 11 Oct 2006 14:09:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Oct 2006 14:09:06 -0000 Received: (qmail 32665 invoked from network); 11 Oct 2006 14:09:06 -0000 Received: from mailfe02.tele2.fr (HELO swip.net) (212.247.154.44) by a.mx.sunsite.dk with SMTP; 11 Oct 2006 14:09:02 -0000 X-T2-Posting-ID: mBXjJ9CYMpI3HGlT2s4LT8j3JzBVs7ioB0ePn7y7rgg= X-Cloudmark-Score: 0.000000 [] Received: from [80.170.35.111] (HELO localhost) by mailfe02.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTPS id 300529055 for zsh-users@sunsite.dk; Wed, 11 Oct 2006 16:09:00 +0200 Date: Wed, 11 Oct 2006 16:08:58 +0200 From: "arno." To: zsh-users@sunsite.dk Subject: Re: pattern matching question Message-ID: <20061011140858.GA22710@localhost.localdomain> References: <20061011130213.GA6307@localhost.localdomain> <20061011131505.GA4262@fsst.voodoo.lan> <200610111329.k9BDT7dW028239@news01.csr.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <200610111329.k9BDT7dW028239@news01.csr.com> User-Agent: Mutt/1.5.13 (2006-08-11) --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Le Wednesday 11 October 2006, =E0 14:29:06PM +0100, Peter a =E9crit : > Frank Terbeck wrote: > > list=3D("... one giraffe ..." "... two cows ..." "... one monkey ..." "= =2E.. thre > > e lemmings ...") > > slist=3D(${(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=3D(${${${(M)list:#*one [a-z]*}##*one }%% *}) Thanks to you and frank for your answers, that works fine. > > 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. I don't really need that much speed, I was just wondering if was possible to match and extract in one go. Anyway, using another language is not an option here: I'm trying to write a completion function. arno --MGYHOYXEY6WxJCY8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFLPr6iH9aBScBsrMRAh8AAJkBGAE8vPpfXZNPE2F0P0x7r54qBQCeJk4s nyksLPqBZdAYMIAYBJkLDEE= =8/z5 -----END PGP SIGNATURE----- --MGYHOYXEY6WxJCY8--