[plt-scheme] inverse regexp

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Wed Jan 21 06:43:21 EST 2009

maxigas wrote:
> i am writing an application using dispatch (as you suggested  
> earlier) which would process all
> URLs, but i want to exclude the htdocs directory to serve static  
> files.  i understand that
> serve/servlet's #:servlet-regexp key controls which URLs are passed  
> to start, but i couldn't find
> out how to write a regexp which excludes "htdocs".
> so what i want is to match everything that is NOT #rx"^/ 
> htdocs/.*" [...]


Sorry I'm so late in replying.

The latest version of Dispatch (v1.10) will do what Jay suggested and  
call next-dispatcher if no rules are matched. Make sure you have the  
latest version, though, because this behaviour changed recently.

I typically write web apps with a single servlet. I use serve/servlet  
like this:

      ; Pass all requests to the servlet:
      #:servlet-path "/"
      #:servlet-regexp #rx""
      ; Configure extra htdocs paths:
      #:extra-files-paths ...)


-- Dave

Posted on the users mailing list.