How to teach django to accept urles in which hyphens are found? Here is part of urls.py

(r'^catalog/(?P<sub>\w+)/(?P<it>\w+)/(?P<spec>\w+)/$',specification), 

It seems to be all right, but as soon as there are hyphens in the address, throws 404 page (

    2 answers 2

    [-\w]+ instead of \w+

    • LinnTroll-thank you . Got it - Vee Sot

    This is probably because:
    \w - a synonym for [[:word:]] - A literal or numeric character or underscore, i.e. hyphen is not there. It is necessary instead of \w use a group of characters, you get something like [a-zA-Z0-9_\-]+

    • Long wrote, I was ahead! )) - Ekkertan