List Info

Thread: Simple Regex In Django routing:




Simple Regex In Django routing:
user name
2007-01-30 10:12:26
What does [-w]+ and [_w]+ in the following:

(?P<category>[-w]+)
(?P<username>[_w]+)


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


Re: Simple Regex In Django routing:
user name
2007-01-30 10:51:33
On 1/30/07, johnny <rampetersgmail.com> wrote:
> What does [-w]+ and [_w]+ in the following:
> (?P<category>[-w]+)
> (?P<username>[_w]+)

They allow you to use different types of slugs.

For example:

/news/2007/jan/30/this-is-my-story/

The regular expression 'w+' won't match the
'this-is-my-story' bit,
but '[-w]+' will.

-- 
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."

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


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )