From users-return-97705-apmail-cocoon-users-archive=cocoon.apache.org@cocoon.apache.org Tue Jun 02 15:32:35 2009 Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 71644 invoked from network); 2 Jun 2009 15:32:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Jun 2009 15:32:35 -0000 Received: (qmail 2018 invoked by uid 500); 2 Jun 2009 15:32:46 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 1948 invoked by uid 500); 2 Jun 2009 15:32:46 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 1940 invoked by uid 99); 2 Jun 2009 15:32:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 15:32:46 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mansour.alakeel@gmail.com designates 209.85.220.212 as permitted sender) Received: from [209.85.220.212] (HELO mail-fx0-f212.google.com) (209.85.220.212) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 15:32:37 +0000 Received: by fxm8 with SMTP id 8so9840871fxm.18 for ; Tue, 02 Jun 2009 08:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=uRE11otBjGwY8zl6IYED9GZ7iOpUquqGm/S/jZf2cWU=; b=Yv9bUsPNHXeMb4BqyiU2AJnRuG08AagEt3eESaPDA2+PT+fFiAIbTnprZAkcabxpxY 4MINXetLcxXwU/5d9Bi7sN0gvbiHVRQCKjXjPz2H1VbTY7Fwyhuvg41zglkfWUzj9uWr eBhRZ8aS4odLImY1wMVv5JU7wLtjbrinf72cE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ZwNv4fxr040ZYBj35qRBMM9XbxLX6Gm8uYdLF/tObr7pHzTARWROp/6PK1DDtkUbl9 oreLZB2WHfbcIm5hWY6UXfIIeYRHz7mWnCVT9nSydQG3ecqaoyGu/AH24uDNtWsv/4a8 eZ1fLicIH7037V/9hFpoxvNUPXnCzxRF45RRI= Received: by 10.103.11.5 with SMTP id o5mr1129405mui.34.1243956735234; Tue, 02 Jun 2009 08:32:15 -0700 (PDT) Received: from mars.lan (CPE0014bf895399-CM0014f8c19014.cpe.net.cable.rogers.com [99.246.237.4]) by mx.google.com with ESMTPS id 23sm18727994mum.35.2009.06.02.08.32.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Jun 2009 08:32:14 -0700 (PDT) Date: Tue, 2 Jun 2009 12:34:32 -0300 From: Mansour Al Akeel To: users@cocoon.apache.org Subject: Re: Regexp matcher with digits Message-ID: <20090602153430.GB7070@mars.lan> References: <20090601193032.6433f9c7@mail.codimat.com.ar> <20090602071558.GG17295@mars.lan> <4A24E41F.9080108@indoqa.com> <20090602150724.GA7070@mars.lan> <4A2543BA.6090000@indoqa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A2543BA.6090000@indoqa.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Checked: Checked by ClamAV on apache.org Thank you, Steven. On Tue Jun 02,2009 05:22 pm, Steven Dolg wrote: > Mansour Al Akeel schrieb: >> On Tue Jun 02,2009 10:34 am, Steven Dolg wrote: >> >>> Mansour Al Akeel schrieb: >>> >>>> For some reasons {0} is matching only the digits, because 1 is empty >>>> always ! >>>> >>>> >>>> ...... >>>> >>>> >>>> >>>> >>>> >>>> My understanding is {0}={1}+{2} but since {1} is empty always, I am >>>> getting {0}={2}. Now the question is how do I capture {1} ? Since the >>>> documentaiton says that regexp works like wildcard matcher, >>>> there should be a way to capture all parts or the regex. >>>> >>>> Any one has an idea ? >>> Your pattern "(\**)([0-9])$" means "any number of asterisks followed by >>> exactly one digit at the end of the string". >>> Any number here means 0 or more. >>> >>> >> Steven, thank you. I see my mistake. I am looking to match anything ends >> with a digit. For example: >> >> hostname/myBlock/news/4 >> hostname/myBlock/services/2 >> hostname/myBlock/news/local/3 >> hostname/myBlock/3 >> >> I need the first part and the digit. The first part can be empty as >> well. >> > The pattern "(.*)(\d+)" should work for the cases you mentioned. ("\d+" > will match 1...n digits; if you just want to allow one digit "\d" is the > thing to do) > > When using "hostname/myBlock/news/local/4" the groups will be: > - {0} = "news/local/4" ({0} is always the whole expression; and > "hostname/myBlock/" will not be forwarded to the sitemap of your block) > - {1} = "news/local/" > - {2} = "4" > > For "hostname/myBlock/3" the groups will be: > - {0} = "3" > - {1} = "" > - {2} = "3" > So {0} == {2}, but this is merely because the first group is empty. > > > HTH, > Steven >> >>> If the string you are using for matching does not contain any asterisks >>> before the digit the first group will be empty. >>> >>> So the question is, what do you want to capture with the first group? >>> >>>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org >>> For additional commands, e-mail: users-help@cocoon.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org >> For additional commands, e-mail: users-help@cocoon.apache.org >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org