Regex to validate url
The url开发者_StackOverflow will be something like: meusite.com/user/{keyword here}
The user will only enter the key word, then I would a regex to validate word if this does not invalidate the URL, blank spaces, special characters and 5 to 22 characters.
You just want to validate the keyword? Something like this should work:
/^[a-zA-Z0-9_\-\.\+]{5,22}$/
But why not just escape it?
精彩评论