Php user name verification must be 5 to 15 characters long. it can only contain letters, numbers, and underlines. php user name verification must be 5 to 15 characters long. it can only contain letters, numbers, and underscores.
Reply content:
Php user name verification must be 5 to 15 characters long and can only contain letters, numbers, and underscores
You can use regular expression verification as follows:
/*** Description username verification */final public static function isName ($ val) {try {$ pattem = "/^ [a-zA-Z0-9 _] {5, 15} $ /"; if (preg_match ($ pattem, $ val) {return $ val;} else {return false ;}} catch (Exception $ e) {throw $ e ;}}
Regular expression
(\ W | \ d) {5, 15}/u
In fact, all the regular rules can be used in general ~ The call method is different ~ I write the same rules in swift as I write on the front end, but the method used to judge the call is different ~