On Thu, 2007-06-14 at 17:36 +0000, hotani wrote:
> Having issues matching a hyphen character in my urls file. Here is an
> example of what needs to be passed: "12-34-56".
> 
> In python, the "\w+" matches this, but django urls will not. 

Since Django's URL pattern matching is done using Python reg-exps, this
can't be correct. In fact, \w does not match a hyphen in Python (it
matches alphanumeric and underscore only).

What  you want is "[-A-Za-z0-9_]+".

The reason [-\w] doesn't work is because inside character classes
([...]), \w no longer means "alphanumeric characters". It's just a
character escape.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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