From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2612 invoked from network); 20 Jul 2004 07:20:33 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Jul 2004 07:20:33 -0000 Received: (qmail 95834 invoked from network); 20 Jul 2004 07:20:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Jul 2004 07:20:27 -0000 Received: (qmail 28285 invoked by alias); 20 Jul 2004 07:19:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7715 Received: (qmail 28273 invoked from network); 20 Jul 2004 07:19:44 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 20 Jul 2004 07:19:44 -0000 Received: (qmail 93987 invoked from network); 20 Jul 2004 07:17:45 -0000 Received: from madrid10.amenworld.com (62.193.203.32) by a.mx.sunsite.dk with SMTP; 20 Jul 2004 07:17:44 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id i6K7Hgc13193 for ; Tue, 20 Jul 2004 09:17:42 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1Bmoqx-0002EK-00>; Tue, 20 Jul 2004 09:15:55 +0200 Date: Tue, 20 Jul 2004 09:15:55 +0200 From: DervishD To: zsh-users@sunsite.dk Subject: Re: Substitution question Message-ID: <20040720071555.GB8475@DervishD> Mail-Followup-To: zsh-users@sunsite.dk References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.1i Organization: Pleyades X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Hi Björn :) * Björn Lindström dixit: > Can somebody tell me what type of patterns are supported in l, in the > $x:s/l/r syntax? Read the info manual, section 'History Expansion', node 'Modifiers'. Scroll down a bit and you'll find the answer. The 'l' part is not a regex :( > I'd like to do something like: > > $x:gs/[^A-Za-z0-9]/_ > > to replace all characters except for the ones listed with underscore. ¿How about using ${x//PATTERN/REPLACEMENT}? Then you can use the patterns valid for filename generation (sort of a regex, more or less powerful depending on the option 'EXTENDED_GLOB'. For your example, I would do: print ${x//[^[:alnum:]]/_} Whether to use 'print' or not is up to your particular use. The double '//' is to say 'make substitutions global, not only the first', and the 'regex' is to say 'al non alphanumeric characters'. Hope this helps. Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/