a regular expression problem
leefurong at gmail.com
Fri Oct 10 17:04:42 CEST 2008
> > 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+
\W should be \w, a typo? :)
> > \b)/(?P<h>\d+)$'.
> > It works when the string is English(like Google), but fails when the
> > string is in foreign language.
if ?u doesn't work, try ?L.
I'm not sure which encoding a url uses.(locale or unicode? I guess
> Care to give an exemple of url that fails ?
> Anyway, if you want to match just *anything* in that path segment, you
> can try:
I don't think he wants to match anything :)
More information about the Python-list