cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boissé Denis <denis.boi...@umontreal.ca>
Subject RE: regexpUriMatcher
Date Thu, 02 Aug 2007 19:07:19 GMT


Thank for you're help:

You said:

^temp/(.*?)/  matches temp/hello/

Yes it's true

^temp/(.*?)/  will also matches temp/hello/dir/ , temp/hello/dir/dir1/, etc

It's the same behaviour for ^temp/(.*?)/$  (I notice that in my program)

Yes it make sense that Cocoon uses Java's builtin regexp classes



-----Message d'origine-----
De : Tobia Conforto [mailto:tobia.conforto@linux.it] 
Envoyé : 2 août 2007 08:50
À : users@cocoon.apache.org
Objet : Re: regexpUriMatcher

Boissé Denis wrote:
> Usually ungreedy matcher are in a form (.*?) and suppose to match
> something like temp/hello/ or temp/hi/ but not matching something like
> temp/hello/dir/ (that's what happen to me)

As Alfred said, you cannot use the 'greediness' of quantifiers to
control the matching of an anchored regexp, because they will always
grow as much as needed to match the string, if possible.

You tipically use them to give more weight to one piece of the regexp
with respect to another piece.  Compare:

^temp/(.*?)/(.*)/$

^temp/(.*)/(.*?)/$

They will match "temp/a/b/c/" as ("a", "b/c") and ("a/b", "c") resp.
What you described is true when the regexp is not anchored:

^temp/(.*?)/  matches temp/hello/
^temp/(.*)/   matches temp/hello/dir/


Anyways, I believe Cocoon uses Java's builtin regexp classes:

http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html


Tobia

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