views:

47

answers:

1

Hello, I want my urls.py to capture a long url setting as such:

/get/<lowercase_string>/<integer>/<date>/<date>/

For instance: www.mysite.com/get/ams/221/12-23-2010/01-10-2011/, as you may see date is in month/day/year format.

As my regex knowledge is near to nothing, I will be grateful for you guidance. I will be capturing <lowercase_string>, <integer>, <date>, <date> parts at my view.

Thanks.

+3  A: 
^get/([a-z]+)/(\d+)/(\d{2}-\d{2}-\d{4})/(\d{2}-\d{2}-\d{4})/

#to capture the values in variables:

^get/(?P<lowercase_string>[a-z]+)/(?P<integer>\d+)/(?P<date1>\d{2}-\d{2}-\d{4})/(?P<date2>\d{2}-\d{2}-\d{4})/
Amarghosh
34 seconds faster :)
Tim Pietzcker