Examples, letters, numbers and Chinese characters
The code is as follows |
|
|
代码如下 |
|
if(preg_match("/[ '.,:;*?~`!@#$%^&+=)(<>{}]|]|[|/||"||/",$user)){ echo '不要在名字里面整些特殊符号,请只使用字母、数字和汉字,当然要你的浏览器要选简体中文GB2312哟,千万不要选繁体、中文HZ等。返回修改后,再来,我等你哟!'; exit(); }
|
if(preg_match("/[ '.,:;*?~`!@#$%^&+=)(<>{}]|]|[|/||"||/" ,$user)){
echo 'Do not include special symbols in the name. Please only use letters, numbers and Chinese characters. Of course, your browser must select Simplified Chinese GB2312. Do not select Traditional or Chinese. HZ wait. Come back after modification, I'll wait for you! ';
exit();
}
Example, full letters
代码如下 |
|
if (mb_ereg("^[w-.]{1,32}$", $str)) { echo 'yes'; } else { echo 'no http://www.111cn.net/'; }
?>
|
The code is as follows |
|
if (mb_ereg("^[w-.]{1,32}$", $str)) { echo 'yes'; } else { echo 'no http://www.111cn.net/'; }
?>
|
Attached are some commonly used regular rules
Can only start and end with numbers or letters. The username must be 4 to 18 characters in length
代码如下 |
|
| utf-8下
preg_match("/^[a-z0-9_x80-xff]+[^_]$/g",$a);
gbk下:
preg_match("/^[a-z0-9_".chr(0xa1)."-".chr(0xff)."]+[^_]$/",$a)
The user name is an uppercase letter, lowercase letter or underscore, and starts with a letter, and the length is 6-20
Username: includes English lowercase, Chinese characters, numbers, and underscores. It cannot be all numbers and the underscore cannot be at the end-
- Chinese username verification is available
-
Articles you may be interested in
- php username regular expression, including Chinese, length 4-16 characters
- Verify email format username url php regular expression
- php username regular expression (Chinese, English, numbers, letters)
- Number and letter regular expression (username verification)
- php regular code to verify username legitimacy
php common regular expressions email username password ip html tag
preg_match regular expression to determine username
php regular verification username
http://www.bkjia.com/PHPjc/739851.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/739851.htmlTechArticleExample, the letters, numbers and Chinese character codes are as follows if(preg_match("/[ '.,:;*?~ `!@#$%^+=)({}]|]|[|/||"||/",$user)){ echo 'Do not include special symbols in the name, please only use letters and numbers ...