The php user registration information verifies the regular expression, and the user registers the regular expression. The php user registration information verifies the regular expression. the regular expression below the regular expression is used to verify the user name. The principle is that such a user name must be a regular expression verified by the php user registration information with a number and a fixed line, user registration regular expression
The following regular expression is used to verify the user name. The user name must be composed of a sequence with a fixed number. let's take a look at the example below.
1. check the user nameWhether it meets the "two or more letters, numbers, or underscores" requirement. the code is as follows:
/*** Check whether the user name meets the requirements ** @ param STRING $ username the user name to be checked * @ return TRUE or FALSE */function is_username ($ username) {$ strlen = strlen ($ username); if (! Preg_match ("/^ [a-zA-Z0-9 _ \ x7f-\ xff] [a-zA-Z0-9 _ \ x7f-\ xff] + $/", $ username) // open source software: phpfensi.com {return false;} elseif (20 <$ strlen | $ strlen <2) {return false;} return true ;}
Two or more letters, numbers, or underscores: ^ [A-zA-Z0-9 _ \ x7f-\ xff] [a-zA-Z0-9 _ \ x7f-\ xff] + $.
Note: Here the letter is a-z, A-Z, and ASCII characters from 127 to 255 (0x7f-0xff)
2. password:It consists of 6 to 20 digits and consists of letters and numbers. the code is as follows:
function isPWD($value,$minLen=5,$maxLen=16){ $match='/^[\\~!@#$%^&*()-_=+|{}\[\],.?\/:;\'\"\d\w]{'.$minLen.','.$maxLen.'}$/'; $v = trim($value); if(emptyempty($v)) return false; return preg_match($match,$v); }
3. email verificationThe code is as follows:
function isEmail($value,$match='/^[\w\d]+[\wd-.]*@[w\d-.]+\.[\w\d]{2,10}$/i'){ $v = trim($value); if(emptyempty($v)) return false; return preg_match($match,$v); }
This article will share with you the user registration information: username, password, and regular expression for mailbox verification. I hope you will learn this article carefully, the regular expression for verifying php user registration information.
The following is a regular expression used to verify the user name. The user name must be a fixed-line string with numbers in the sequence...