Run the above code, you will be prompted: Warning: preg_match(): Compilation failed: PCRE does not support L, l, N, P, p, U, u, or X at offset 3 in F:wwwrootphptest.php on line 2 The reason is because: PHP regular expressions do not support the following Perl escape sequences: L, l, N, P, p, U, u, or X In UTF-8 mode, "x{...}" is allowed, and the content in the curly brackets is a string representing a hexadecimal number. The original hexadecimal escape sequence xhh matches a double-byte UTF-8 character if its value is greater than 127. Solution: preg_match("/^[x80-xff_a-zA-Z0-9]{3,15}$",$strName); For example, the following example:
|