shibly shibly - 1 year ago 70
Python Question

How can I set a url that takes one parameter with aphanumeric string?

What I'm trying to do:

url(r'^confirmemail/[a-bA-z0-9]+/', 'blog.views.confirmemail'),

The exact url would be something like that: or

The length of the string parameter would be ten(10).

How can write that url in

Answer Source

url(r'^confirmemail/(?P<code>[a-zA-Z0-9]+)/', 'blog.views.confirmemail'),


url(r'^confirmemail/(?P<code>[a-zA-Z0-9]{10})/', 'blog.views.confirmemail'), to restrict length to the 10 symbols.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download