views:

260

answers:

1

Im trying to work out a url that will match domain.com\about-us\ & domain.com\home\

I have a url regex:

^(?P<page>\w+)/$

but it won't match the url with the - in it.

I've tried

^(?P<page>\.)/$
^(?P<page>\*)/$

but nothing seems to work.

+9  A: 

Try: ^(?P<page>[-\w]+)/$

[-\w] will accept a-z 1-9 and dash

Regular expressions are definitely not my strong suit, so this helped me out a ton!
MattGWagner