I have a site where users can create their own profile pages with their own Custom URLs. For example: http://www.website.com/MyProfilePage or http://www.website.com/JohnnysPage
I need a regular expression that only allows a-Z 0-9 and – (hyphens). No spaces or other characters.
So, for example it would…
FAIL ON THESE STRINGS
http://www.website.com/MyProfilePage
My Profile Page
My.Profile.Page
My_Profile_Page
My/Profile/Page
Katie'sPage
etc. etc.
PASS ON THESE STRINGS
MyProfilePage
KatiesPage
MyProfilePage
Davids-Page
TheBestPage-2001
etc. etc.
Thanks!
I would say simply: