From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20770 invoked from network); 10 Dec 2003 13:40:55 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 10 Dec 2003 13:40:55 -0000 Received: (qmail 25141 invoked by alias); 10 Dec 2003 13:40:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6860 Received: (qmail 25112 invoked from network); 10 Dec 2003 13:40:36 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 10 Dec 2003 13:40:36 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 10 Dec 2003 13:40:36 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-16.tower-36.messagelabs.com!1071063634!2379178 X-StarScan-Version: 5.1.13; banners=-,-,- Received: (qmail 16318 invoked from network); 10 Dec 2003 13:40:34 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-16.tower-36.messagelabs.com with SMTP; 10 Dec 2003 13:40:34 -0000 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id hBADeYuB031465; Wed, 10 Dec 2003 13:40:34 GMT Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id hBADiY220988; Wed, 10 Dec 2003 14:44:34 +0100 cc: Zsh users list X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20031210131756.GA29126@fruitcom.com> From: Oliver Kiddle References: <20031210124617.GA3027@fruitcom.com> <7336.1071061393@csr.com> <20031210131756.GA29126@fruitcom.com> To: Eric Smith Subject: Re: regexing to remove punctutation in telephone numbers Date: Wed, 10 Dec 2003 14:44:34 +0100 Message-ID: <20986.1071063874@gmcs3.local> Eric Smith wrote: > > > > > myfax () { > > command myfax "${1//[-()]}${2//[-()]}" ${argv[3,-1]} > > } > > There can be n number of args with the offending punctutation characters. > And n should be determined from the first arg that commences in a non > [-()0-9] character. myfax() { local last=${argv[(i)[^-()0-9]*]} command myfax "${(j..)argv[1,last-1]//[-()]}" "$argv[last,-1]" } That uses the (i) subscript flag to find the first arg commencing with a different character. I'd be inclined to check all characters: (^[-()0-9]#) You could use a loop to do the same.