I am using Django for my application and needed to do a pattern matching
Pattern to be matched: users/?q=john Regular expression : '^users/\?q\=(?P[\w]+)[/]?$'
like this in urls.py
url(r'^users/\?q\=(?P[\w]+)[/]?$', user_handler, {'emitter_format' : 'json'})
However it's no开发者_Go百科t matching the URL, any pointers would be helpful.
Thanks
In CGI, everything after ? is put into request.GET and does not even get to url matching - take a look here:
- http://docs.djangoproject.com/en/dev/ref/request-response/
In your handler (user_handler
), you can use:
request.GET['q']
to get john
from the above sample URL.
精彩评论