cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David <cocoon-n...@max-imp.com>
Subject Re: negate match
Date Thu, 08 Sep 2005 21:26:12 GMT
Tony Collen wrote:
> Tony Collen wrote:
> 
>> Hmm, it actually might not be all that easy.  The RegexpURIMatcher 
>> uses the org.apache.regexp package.
>>
>> Details about the syntax are at:
>>
>> http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html
>>
>> and it seems like you can do negation, but only with character classes 
>> (Unless I'm missing something painfully obvious)
>>
>> I guess the brute force ugly way would be to subclass 
>> AbstractRegexpMatcher to return true if the RE *doesn't* match, or 
>> allow the matcher to take a parameter to tell it to use inverse logic 
>> for determining a match.
> 
> 
> 
> I take that back. This works:
> 
>     <map:match type="regexp" pattern="^bob$">
>           <map:generate src="bob.xml"/>
>           <map:serialize type="xml"/>
>     </map:match>
> 
>     <map:match type="regexp" pattern="[^b][^o][^b]">
>         <map:generate src="notbob.xml"/>
>         <map:serialize type="xml"/>
>     </map:match>
> 
> HTH,
> 
> Tony


The problem with the above is it will only match 3 letter long urls (I 
am pretty sure). Eg. 'ab' would not be matched by the second regex.

The regular expression I need to use is also much more complex then 'bob'

Knowing what regular expression library is a good thing to know. Thanks. 
That should help me figure it out.

David


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


Mime
View raw message