From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21178 invoked from network); 4 Aug 2003 15:50:19 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Aug 2003 15:50:19 -0000 Received: (qmail 5842 invoked by alias); 4 Aug 2003 15:50:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6438 Received: (qmail 5833 invoked from network); 4 Aug 2003 15:50:04 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 4 Aug 2003 15:50:04 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [199.67.51.101] by sunsite.dk (MessageWall 1.0.8) with SMTP; 4 Aug 2003 15:50:3 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h74FnsQn016529; Mon, 4 Aug 2003 10:49:54 -0500 (CDT) (envelope-from dan) Date: Mon, 4 Aug 2003 10:49:54 -0500 From: Dan Nelson To: ZSH User List , Thomas =?utf-8?Q?K=C3=B6hler?= Subject: Re: something simple (I hope) Message-ID: <20030804154954.GL38843@dan.emsphone.com> References: <20030804143351.GA14857@spiegl.de> <20030804151216.GB25043@picard.franken.de> <20030804153810.GA17793@spiegl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030804153810.GA17793@spiegl.de> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i In the last episode (Aug 04), Andy Spiegl said: > > > I want to put all files that match the regex pattern > > > "^/var/tmp/exec\.[0-9]+$" > > > into a list that I can then use in a foreach loop. > > > for i in /var/tmp/exec.[0-9][0-9]* ; do echo $i ; done > Thanks but I really need a list (with a name). > Actually in the meantime I found out how to do that: > files=(/var/tmp/exec.[[:digit:]]*) > > But what is still bugging me is that this also matches files like > /var/tmp/exec.01234.something > > I can't figure out how to tell zsh that there shouldn't be anything _after_ > digits. What is the zsh-equivalent of a $ in regular expressions? Your problem isn't the lack of "$" (glob patterns always anchor to the start and end so ^ and $ operators are unneeded), it's your use of "*". "*" in a glob pattern means "match any character", and is equivalent to the regex ".*" . Try "/var/tmp/exec.<->". <-> is the numeric range operator with no minimum or maximum number, so it matches any numeric value. The zsh equivalent to the regex "+" is "##", so you could also use "/var/tmp/exec.[0-9]##" (make sure EXTENDED_GLOB is set). -- Dan Nelson dnelson@allantgroup.com