> If i have a URL such as:
> 
>  (r'^(?P<username>\w+)/blog/', include('foo.urls.blog')),
> 
> what are the whats the purpose of the w and the +? i'm having some
> problems with 2 of my urls and i think it may have something to do
> with this.

You'll want to read up on regular expressions.  There are a 
number of good tutorials and books on the subject.  In short, in 
this case the "\w" is "any 'word' character" (usually 
[a-zA-Z0-9_] and if the regexp is compiled with unicode support, 
I believe it supports unicode "letter/digit" type characters). 
Note that this *doesn't* include things like the minus sign, the 
"@", and a variety of other characters you might wish to include 
in a username.

The "+" is the "one-or-more of the previous atom [the '\w']" 
repetition operator.  So your regexp is "one or more 'word' 
characters, followed by a slash, followed by the literal 'blog', 
followed by another slash".

Regexps are very powerful, though the regexp-reversing code in 
Django doesn't gracefully handle some of the more complex cases 
because it's a non-trivial problem.

-tkc




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to