I have the following url
url(r'^(?P<name>[A-Za-z0-9-]+)/$', 'user', name='user')
This matches URLS like /tom/ and /tom-max/ but not on URL's like /tom-2/ or tom-brandy-monster which I want.
Basically I would like to capture a combination of hyphens, letters and numbers.
UPDATE
This is in my urls.py
urlpatterns = patterns('',
url(r'^$', 'homepage.views.home', name='home'),
url(r'^user/', include('users.urls')),
url(r'^plans/', include('plans.urls')),
url(r'^admin/', include(admin.site.urls)),
)
This is in my users/urls.py
urlpatterns = patterns(
'users.views',
url(r'^(?P<user>[A-Za-z0-9-]+)/$', 'user', name='user'),
)
UPDATE2
The fault was in my views. This regex works for all the above-mentioned examples.
users.urls.py? I hope you meanusers/urls.py?user/. And I presume that the only thing that you've left out of yoururls.pyfiles as they are put here are the imports?