Reputation: 6631
I'm writing a url rewrite in django that when a person goes to http://mysite.com/urlchecker/http://www.google.com it sends the url: http://ww.google.com to a view as a string variable.
I tried doing:
(r'^urlchecker/(?P<url>\w+)/$', 'mysite.main.views.urlchecker'),
But that didn't work. Anyone know what I'm doing wrong?
Also, generally is there a good resource to learn regular expressions specifically for python/django?
Thanks guys!
Upvotes: 2
Views: 301
Reputation: 17713
I just learned something while grazing the Hidden Features of Python thread. Python's re compiler has a debug mode! (Who knew? Well, apparently someone did :-) Anyway, it's worth a read.
Upvotes: 0
Reputation: 17713
Try this instead:
(r'^urlchecker/(?P<url>.+)$', 'mysite.main.views.urlchecker'),
This differs from yours in that:
Upvotes: 2