开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜