cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: Regexp matcher with digits
Date Tue, 02 Jun 2009 15:07:25 GMT
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 !
>>
>>       <map:match  type="regexp" pattern="(\**)([0-9])$">
>>         ......
>>         <map:transform src="transform.xsl">
>>                 <map:parameter name="href" value="{1}"/>
>>             <map:parameter name="depth" value="{2}"/>
>>         </map:transform>
>>
>> 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.

> 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


Mime
View raw message