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 !
>>>>
>>>> <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.
>>
> 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
|