I need to validate a username in PHP. It can be:
How do I do this?
Start with this:
/^[a-zA-Z0-9:.,?!@]{3,15}[#$^]?$/
then refine it to your needs. Try to see if you need escaping of the special char, but you should get the idea.
This means: from a to z, from A to Z, from 0 to 9 and :.,?!@ repeated from 3 to 15 times, optionally followed by one among #$^
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.