I've been advocating the use of doctests in routes.py to debug problems. Here's another doctest you can use (I'll send a patch to Massimo that adds an example).
>>> compile_re('.*http://otherdomain.com.* (?P<any>.*)', '/app/ctr\g<any>')[0].pattern '^.*http://otherdomain.com.* (?P<any>.*)$' >>> compile_re('.*http://otherdomain.com.* (?P<any>.*)', '/app/ctr\g<any>')[1] '/app/ctr\\\\g<any>' >>> compile_re('/$c/$f', '/init/$c/$f')[0].pattern '^.*?:https?://[^:/]+:[a-z]+ /(?P<c>[\\\\w_]+)/(?P<f>[\\\\w_]+)$' >>> compile_re('/$c/$f', '/init/$c/$f')[1] '/init/\\\\g<c>/\\\\g<f>' For the trunk version, the import line needs to change to this: from gluon.rewrite import select, load, filter_url, filter_out, filter_err, compile_re Notice that the backslash escaping gets a little confusing. I can't figure out how to use raw strings properly here; so it goes.