Reputation: 18919
Hi I have a url pattern like so:
url(
r'^project_info/(?P<product>\w+)/$',
'tool.views.ProjectInfo',
name='project_info'
),
this works fine for normal strings, but if I want to capture something like 'my-product' it fails.
I have tried escaping the dash like so:
url(
r'^project_info/(?P<product>\-\w+)/$',
'tool.views.ProjectInfo',
name='project_info'
),
but no joy.
Any help would be much appreciated.
Upvotes: 0
Views: 304
Reputation: 9917
This should work for you
url(
r'^project_info/(?P<product>[-\w]+)/$',
'tool.views.ProjectInfo',
name='project_info'
),
Upvotes: 6