From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17011 invoked by alias); 19 Oct 2011 08:26:11 -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: 16519 Received: (qmail 5171 invoked from network); 19 Oct 2011 08:26:08 -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=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at spodhuis.org does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201107; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=IphvxJE+A/NsF8xygQkkz6f8QygW+O5ZM1Ui0YGx1HY=; b=lq62TzzXWK80DTHS6KaukduYXLH6w4oon0fNJvbdM76OegsKfrVzBv7XcbYZPBVg2Hc6h5OG9AlvPWJtEkH48YsuEX8RL+0zHy/GAbysc3rOgKqNZICS54pDvgNOkzDxQKG17+x9ilImluvjpIXWDaMTacur/Zn/qqQUrtq7wLE=; Date: Wed, 19 Oct 2011 04:26:00 -0400 From: Phil Pennock To: "Daniel Serodio (lists)" Cc: Mikael Magnusson , zsh-users@zsh.org Subject: Re: What's wrong with this expression? Message-ID: <20111019082600.GA2541@redoubt.spodhuis.org> Mail-Followup-To: "Daniel Serodio (lists)" , Mikael Magnusson , zsh-users@zsh.org References: <4E9C9997.3050306@mandic.com.br> <4E9C9DB4.50104@mandic.com.br> <20111018041939.GA52377@redoubt.spodhuis.org> <4E9D7A3C.9040605@mandic.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E9D7A3C.9040605@mandic.com.br> On 2011-10-18 at 11:08 -0200, Daniel Serodio (lists) wrote: > >> Ooops. Error copy'n'pasting. The actual line in the script that fails is: > >> > >> if [[ ! "${PATH}" =~ $regex ]] ; then > Thanks a lot. This computer is running zsh 4.2.6, I'll try to have it > updated. 4.2.6 does not have the =~ operator. =~ was added on 2007-05-01, when Peter applied my patch (I'm the one who made the mistake which led to ! not working right). The first release of zsh with this in was 4.3.5, released on or around 2008-02-01. zsh 4.2.6 was released on or around 2005-12-03. Try using -pcre-match instead -- zsh has had PCRE regex support for a long time, it's only the =~ support and the zsh/regex for using the system POSIX regexp libraries for extended regexps that were new with 4.3.5. For those versions of zsh with =~ support, it does extended regexps by default, unless you setopt REMATCH_PCRE. Anything which is a valid extended regexp pattern is likely to be a valid PCRE regexp (but not the other way around). "man pcrepattern" for more details. if [[ ! "${PATH}" -pcre-match $regex ]]; then # ... fi -Phil