开发者

Regex for Username?

开发者 https://www.devze.com 2022-12-28 21:06 出处:网络
I am using C# and jQuery to valid a username with Regex. Just learning :) So far I have UserName = \"[开发者_如何学Goa-zA-Z0-9]\";

I am using C# and jQuery to valid a username with Regex. Just learning :) So far I have

UserName = "[开发者_如何学Goa-zA-Z0-9]";

But this doesn't stop symbols ? How to ensure that no symbols or " . " or " _ " ?

Thanks


That regex says "At least one letter or number" you want "Every character from the start to the end is a letter or number"

"^[a-zA-Z0-9]+$"


you can also add @ , . %^&* digits character in below regex @"^[a-zA-Z0-9._@#$% ]+$"

0

精彩评论

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