Ec (2); php tutorial username Regular Expression (Chinese, English, numbers, letters) by letter ~ Z (Case Insensitive), numbers 0 ~ 9. The combination of a minus sign or an underscore can only start with a number or a letter and end with a username of 4 ~ 18 characters ^ [a-za-z0-9] {1} [a-za-z0-9 |-| _] {2-16} [a-za-z0-9] {1} $ the username is an uppercase letter, lowercase letter, or underline, it must start with a letter and have a length of 6-20 ^ [a-za-z] [wd _] {5, 1 script ec (2); script
Php tutorial username Regular Expression (Chinese, English, numbers, letters)
By letter ~ Z (Case Insensitive), numbers 0 ~ 9. Combination of minus signs or underscores
The username must start with a number or letter and end with a length of 4 ~ 18 characters
^ [A-za-z0-9] {1} [a-za-z0-9 |-| _] {2-16} [a-za-z0-9] {1} $
The username is an uppercase letter, lowercase letter, or underscore, and starts with a letter. The username must be 6-20 characters long.
^ [A-za-z] [wd _] {5, 19}
Username: the username can contain lowercase letters, Chinese characters, numbers, and underscores (_). The username cannot contain only numbers, but cannot contain underscores (_).
/^ [A-z0-9_u4e00-u9fa5] + [^ _] $/g
UTF-8
Preg_match ("/^ [a-z0-9_x80-xff] + [^ _] $/g", $ );
Under gbk:
Preg_match ("/^ [a-z0-9 _". chr (0xa1). "-". chr (0xff). "] + [^ _] $/", $)
User name verification in Chinese
[A-za-z0-9] [u4e00-u9fa5]
Because the expression we write matches any part of a string. It not only considers 'Mike _ 84 'as a valid string, but also matches' %! The string mike_84 & 'contains something we don't want to see. We need to use row positioning points. The ^ (caret) and $ (dollar) characters will limit our expression to the start and end positions of a string, this ensures that the entire user name conforms to our settings, rather than part of the user name.
Therefore, the regular expression of the revised version is as follows:
/^ [A-za-z0-9 _] {} $/