简体   繁体   中英

Regex for Username?

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

UserName = "[a-zA-Z0-9]";

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

Thanks

那个正则表达式说“至少有一个字母或数字”你想要“从头到尾的每个字符都是一个字母或数字”

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM