You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Erasmo <ei...@gmail.com> on 2008/08/28 18:44:08 UTC

RegexpURIMatcher quantifier doesn't work

I'm trying to use this regex expression in a matcher but as soon as i use
the quantifier {n} or {n,m} ^/file/id/([0-9]{3})$ Cocoon throws an
exception:

org.apache.cocoon.sitemap.PatternException: String index out of range: 21 at
org.apache.cocoon.components.treeprocessor.variables.StringTemplateParserVariableResolver.setExpression(StringTemplateParserVariableResolver.java:70)

Does this matcher not support quantifiers?

Re: RegexpURIMatcher quantifier doesn't work

Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Aug 28, 2008, at 4:36 PM, Erasmo wrote:

> Because of this i think it is trying to parse the braces as a  
> resolvable substitution.
>
> ....
> Caused by: org.apache.cocoon.sitemap.PatternException: Mismatching  
> braces in expression "^file/([a-z0-9\-]{1,256)quot;
> at  
> org 
> .apache 
> .cocoon 
> .template 
> .expression 
> .AbstractStringTemplateParser 
> .parseSubstitutions(AbstractStringTemplateParser.java:103)
> ....
>
> How can i configure the matcher or the sitemap or whatever to not  
> parse the pattern attribute?

http://cocoon.apache.org/2.0/userdocs/matchers/matchers.html

Use '\' to escape '{' and '}' braces.


Vadim


> On Thu, Aug 28, 2008 at 12:36 PM, Erasmo <ei...@gmail.com>  
> wrote:
> Well i have replaced the matcher with one of my own and the  
> exception is still being thrown. It looks like is the sitemap parser  
> which is throwing the exception as soon as i include the "{ }"  
> characters in the pattern attribute. I have tested this:
>
> 1.- Adding " } " alone throws:   
> org.apache.cocoon.sitemap.PatternException: Mismatching braces in  
> expression "^file/([a-z0-9\-]{)$
> 2.- Adding " { " alone everything works, regex do not match of course.
> 3.- Adding " { } " throws: index out of range exception.
> 4.- Adding " {2} " throws: index out of range exception.
>
> Any clues?
>
>
> On Thu, Aug 28, 2008 at 9:44 AM, Erasmo <ei...@gmail.com>  
> wrote:
> I'm trying to use this regex expression in a matcher but as soon as  
> i use the quantifier {n} or {n,m} ^/file/id/([0-9]{3})$ Cocoon  
> throws an exception:
>
> org.apache.cocoon.sitemap.PatternException: String index out of  
> range: 21 at  
> org 
> .apache 
> .cocoon 
> .components 
> .treeprocessor 
> .variables 
> .StringTemplateParserVariableResolver 
> .setExpression(StringTemplateParserVariableResolver.java:70)
>
> Does this matcher not support quantifiers?
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: RegexpURIMatcher quantifier doesn't work

Posted by Erasmo <ei...@gmail.com>.
Because of this i think it is trying to parse the braces as a resolvable
substitution.

....
Caused by: org.apache.cocoon.sitemap.PatternException: Mismatching braces in
expression "^file/([a-z0-9\-]{1,256)quot;
at
org.apache.cocoon.template.expression.AbstractStringTemplateParser.parseSubstitutions(AbstractStringTemplateParser.java:103)
....

How can i configure the matcher or the sitemap or whatever to not parse the
pattern attribute?


On Thu, Aug 28, 2008 at 12:36 PM, Erasmo <ei...@gmail.com> wrote:

> Well i have replaced the matcher with one of my own and the exception is
> still being thrown. It looks like is the sitemap parser which is throwing
> the exception as soon as i include the "{ }" characters in the pattern
> attribute. I have tested this:
>
> 1.- Adding " } " alone throws:  org.apache.cocoon.sitemap.PatternException:
> Mismatching braces in expression "^file/([a-z0-9\-]{)$
> 2.- Adding " { " alone everything works, regex do not match of course.
> 3.- Adding " { } " throws: index out of range exception.
> 4.- Adding " {2} " throws: index out of range exception.
>
> Any clues?
>
>
> On Thu, Aug 28, 2008 at 9:44 AM, Erasmo <ei...@gmail.com> wrote:
>
>> I'm trying to use this regex expression in a matcher but as soon as i use
>> the quantifier {n} or {n,m} ^/file/id/([0-9]{3})$ Cocoon throws an
>> exception:
>>
>> org.apache.cocoon.sitemap.PatternException: String index out of range: 21
>> at
>> org.apache.cocoon.components.treeprocessor.variables.StringTemplateParserVariableResolver.setExpression(StringTemplateParserVariableResolver.java:70)
>>
>> Does this matcher not support quantifiers?
>>
>
>

Re: RegexpURIMatcher quantifier doesn't work

Posted by Erasmo <ei...@gmail.com>.
Well i have replaced the matcher with one of my own and the exception is
still being thrown. It looks like is the sitemap parser which is throwing
the exception as soon as i include the "{ }" characters in the pattern
attribute. I have tested this:

1.- Adding " } " alone throws:  org.apache.cocoon.sitemap.PatternException:
Mismatching braces in expression "^file/([a-z0-9\-]{)$
2.- Adding " { " alone everything works, regex do not match of course.
3.- Adding " { } " throws: index out of range exception.
4.- Adding " {2} " throws: index out of range exception.

Any clues?

On Thu, Aug 28, 2008 at 9:44 AM, Erasmo <ei...@gmail.com> wrote:

> I'm trying to use this regex expression in a matcher but as soon as i use
> the quantifier {n} or {n,m} ^/file/id/([0-9]{3})$ Cocoon throws an
> exception:
>
> org.apache.cocoon.sitemap.PatternException: String index out of range: 21
> at
> org.apache.cocoon.components.treeprocessor.variables.StringTemplateParserVariableResolver.setExpression(StringTemplateParserVariableResolver.java:70)
>
> Does this matcher not support quantifiers?
>