简体   繁体   中英

C# asp.net mvc Username regex

Im looking for regex for usernames

I want to allow:

  • only ASCII
  • only - _ symbols
  • minium 5 characters and maximum 15

Here you go

^[-0-9A-Za-z_]{5,15}$

Note that the - is put first in the character class otherwise it will get the meaning of indicating a range as in 0-9 = 0 to 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