a regular expression problem

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri Oct 10 08:58:33 EDT 2008


lookon a écrit :
> I want to use django to dispatch url.
> The url is like /test/Google/6,and my patten is r'^/test/(?P<q>\b\W+
> \b)/(?P<h>\d+)$'.
> It works when the string is English(like Google), but fails when the
> string is in foreign language.

Care to give an exemple of url that fails ?

Anyway, if you want to match just *anything* in that path segment, you 
can try:

r'^/test/(?P<q>.+?)/(?P<h>\d+)$'.






More information about the Python-list mailing list