From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25707 invoked from network); 15 Jan 2009 00:53:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Jan 2009 00:53:23 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 36899 invoked from network); 15 Jan 2009 00:53:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Jan 2009 00:53:14 -0000 Received: (qmail 2188 invoked by alias); 15 Jan 2009 00:53:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26312 Received: (qmail 2177 invoked from network); 15 Jan 2009 00:53:10 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 15 Jan 2009 00:53:10 -0000 Received: from mx.spodhuis.org (redoubt.spodhuis.org [193.202.115.177]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 6566080271F0 for ; Thu, 15 Jan 2009 01:53:06 +0100 (CET) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition; b=MycFA4wENh5EbTF5P+PLulz3mOcCxg2cKk1iqtj+9crxHaa9R+9zVRdrL1QqUe66SamKbTdWzdcgVhJNcQL1zKqYJcI4gm/V8J3ykMn9uui8MJCfHm2yr3EkJQRmsfLA9d121et88RsVRTKVOxK2pvpa3DIvM7vLUzuWx36NNvI=; Received: by smtp.spodhuis.org with local id 1LNGTo-0005Hf-Qy; Thu, 15 Jan 2009 00:53:04 +0000 Date: Wed, 14 Jan 2009 16:53:04 -0800 From: Phil Pennock To: zsh-workers@sunsite.dk Subject: [PATCH] documentation update =~ regex MATCH Message-ID: <20090115005304.GA9290@redoubt.spodhuis.org> Mail-Followup-To: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: ClamAV 0.92.1/8865/Wed Jan 14 18:37:08 2009 on bifrost X-Virus-Status: Clean The patch below should update the docs to make it clearer that no variables are touched if regex matches fail. yodl is currently segfaulting for me, so I can't test a make from them. It looks like simple text changes which Can't Possibly Go Wrong, though, so unless someone shouts I'll commit this anyway in a day or so. Index: Doc/Zsh/cond.yo =================================================================== RCS file: /home/cvsroot/zsh/Doc/Zsh/cond.yo,v retrieving revision 1.5 diff -a -u -p -r1.5 cond.yo --- Doc/Zsh/cond.yo 13 May 2007 20:18:28 -0000 1.5 +++ Doc/Zsh/cond.yo 15 Jan 2009 00:48:30 -0000 @@ -115,6 +115,8 @@ var(regexp). If the option tt(RE_MATCH_ var(regexp) is tested as a PCRE regular expression using the tt(zsh/pcre) module, else it is tested as a POSIX extended regular expression using the tt(zsh/regex) module. +Upon successful match, some variables will be updated; no variables +are changed if the matching fails. If the option tt(BASH_REMATCH) is set the array tt(BASH_REMATCH) is set to the substring that matched the pattern followed by the substrings that matched parenthesised Index: Doc/Zsh/mod_pcre.yo =================================================================== RCS file: /home/cvsroot/zsh/Doc/Zsh/mod_pcre.yo,v retrieving revision 1.6 diff -a -u -p -r1.6 mod_pcre.yo --- Doc/Zsh/mod_pcre.yo 1 May 2007 22:05:05 -0000 1.6 +++ Doc/Zsh/mod_pcre.yo 15 Jan 2009 00:45:31 -0000 @@ -26,13 +26,15 @@ item(tt(pcre_match) [ tt(-v) var(var) ] Returns successfully if tt(string) matches the previously-compiled PCRE. -If the expression captures substrings within parentheses, +Upon successful match, +if the expression captures substrings within parentheses, tt(pcre_match) will set the array var($match) to those substrings, unless the tt(-a) option is given, in which case it will set the array var(arr). Similarly, the variable var(MATCH) will be set to the entire matched portion of the string, unless the tt(-v) option is given, in which case the variable var(var) will be set. +No variables are altered if there is no successful match. ) enditem() Index: Doc/Zsh/mod_regex.yo =================================================================== RCS file: /home/cvsroot/zsh/Doc/Zsh/mod_regex.yo,v retrieving revision 1.1 diff -a -u -p -r1.1 mod_regex.yo --- Doc/Zsh/mod_regex.yo 2 May 2007 11:13:15 -0000 1.1 +++ Doc/Zsh/mod_regex.yo 15 Jan 2009 00:44:33 -0000 @@ -8,9 +8,11 @@ startitem() findex(regex-match) item(var(expr) tt(-regex-match) var(regex))( Matches a string against a POSIX extended regular expression. -The matched portion of the string will normally be placed in the tt(MATCH) +On successful match, +matched portion of the string will normally be placed in the tt(MATCH) variable. If there are any capturing parentheses within the regex, then the tt(match) array variable will contain those. +If the match is not successful, then the variables will not be altered. For example,