From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10400 invoked from network); 10 Dec 2003 13:18:48 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 10 Dec 2003 13:18:48 -0000 Received: (qmail 1392 invoked by alias); 10 Dec 2003 13:18:03 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6859 Received: (qmail 1372 invoked from network); 10 Dec 2003 13:18:01 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 10 Dec 2003 13:18:01 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.201.175.88] by sunsite.dk (MessageWall 1.0.8) with SMTP; 10 Dec 2003 13:18:0 -0000 Received: from localhost (pepper [127.0.0.1]) by pepper.fruitcom.com (Postfix) with ESMTP id D728C69FF2; Wed, 10 Dec 2003 14:17:59 +0100 (CET) Received: from pepper.fruitcom.com ([127.0.0.1]) by localhost (pepper [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03208-03; Wed, 10 Dec 2003 14:17:56 +0100 (CET) Received: by pepper.fruitcom.com (Postfix, from userid 1000) id D406269F43; Wed, 10 Dec 2003 14:17:56 +0100 (CET) Date: Wed, 10 Dec 2003 14:17:56 +0100 From: Eric Smith To: Zsh users list Subject: Re: regexing to remove punctutation in telephone numbers Message-ID: <20031210131756.GA29126@fruitcom.com> References: <20031210124617.GA3027@fruitcom.com> <7336.1071061393@csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7336.1071061393@csr.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian os) Peter Stephenson said: > Eric Smith wrote: > > Could someone suggest a neat zsh way to convert > > > > $ myfax 00-(123) 4567-890 _some_file_name_ AnotherFileName.ps whatever > > > > to > > > > 001234567890 _some_file_name_ AnotherFileName.ps whatever > > I don't know how flexible you want to be, but: Thanks Peter, Thats exactly the point ... > > 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. -- Eric Smith