From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9203 invoked by alias); 24 Feb 2011 10:28:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15827 Received: (qmail 11539 invoked from network); 24 Feb 2011 10:28:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.12 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: zzapper Subject: Re: Regular expressions in zsh Date: Thu, 24 Feb 2011 10:28:19 +0000 (UTC) Organization: SuccessTheory Message-ID: References: <20110219033809.GA72507@quark.hightek.org> <20110219054807.GA57597@redoubt.spodhuis.org> X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dsl78-143-228-30.in-addr.fast.co.uk User-Agent: Xnews/2006.08.24 X-Antivirus: avast! (VPS 110223-1, 23/02/2011), Outbound message X-Antivirus-Status: Clean zzapper wrote in news:Xns9E95A9D1688C0zzappergmailcom@80.91.229.10: > Phil Pennock wrote in news:20110219054807.GA57597@redoubt.spodhuis.org: > > >> >> zsh has had -pcre-match for a very long time; it's only the =~ operator >> which is newish; note that if you're a Perl fan, then you might: >> with a little help from zsh-lovers webpage zmodload zsh/pcre setopt REMATCH_PCRE var=ddddd; [[ "$var" =~ ^d+$ ]] && echo matched || echo did not match var=dddee; regexp="^e+$"; [[ "$var" =~ $regexp ]] && echo $regexp matched $var || echo $regexp did not match $var # above should be on one line -- zzapper http://zzapper.co.uk/ Technical Tips