David wrote:

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.

It will not even match all 3-letter URLs other than 'bob'. For example, it will not match 'ben' because its first letter is 'b'.


However, you can get the right behavior by doing this:

   <map:match pattern="bob">
      <!-- return 404 or whatever you want to do for 'bob' -->
      <map:serialize ... />
   </map:match>

   <map:match pattern="**">
      <!-- here's where you match everything except 'bob' -->
   </map:match>

Since the first pattern that matches a URL is the one that fires, the second pattern will match everything except whatever is matched by previous patterns... So the second pattern will match everything except 'bob'.
Does that fit your requirements?

Lars



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to