attribute: Phillie Casablanca

Thanks Regex Coach



I was having trouble with getting my urls to match using regex in the django urls.py.

I was trying to get a single detailed post working using the generic view, "date-based object detail".
http://www.djangoproject.com/documentation/0.96/generic_views/#django-views-generic-date-based-object-detail

Once I got the regex right I was able to gradually debug through the rest of my issues to get it working.
I still don't fully understand the urlpatterns setting, but I understand it a little more now.

A single entry in the pattern file seems to take the following structure:
([regex for the url], [target function name to pass data to], [dictionary of additional options to pass to the function])

I'm using the ?P<name> tags in the regex, which will additionally pass the resulting information to the target function defined using the reference name in the <name> space. Other than regex itself, this part was probably what took the longest to understand.

I just want to say thanks for regex coach, I'm sure there are other similar tools out there, but I remembered this tool back when I was fighting with regex in perl. Simple but very helpful for discovering if the expression your thinking of actually matches your target text string.
http://weitz.de/regex-coach/

(And also the webmonkey cheetsheet and special characters references I've been using these since I first started learning html back in 98 or so)

monkut // April 17, 2008 // 9:16 a.m.