Method One
The code is as follows
if (Preg_match ("/^d*$/", "4312"))
{
echo "Full digit
";
}
if (Preg_match ("/^[a-z]*$/i", "FDSFDFD"))
{
echo "Full letter
";
}
if (Preg_match ("/^[a-zd]*$/i", "fd4fd34"))
{
echo "has numbers with letters.
";
}
Chinese characters
The code is as follows
$username =$_request[' username '];
if (!preg_match ("/^[a-z0-9xa1-xff]{3,10}$/", $username))
{
echo "34r345";
Exit
}
The above is quite scattered, the following a few summed up together to
code is as follows
$input _tag = $_post[' tag '];
$input _tag = Explode (', ', $input _tag);
$input _tag = Array_unique ($ Input_tag);
$input _tag = Array_diff ($input _tag, array (null));
$leng = ';
$true = ';
$comma = ';
foreach ($input _tag as $v) {
if (strlen ($v) >) {
$leng . = $comma. $v;
$comma = ', ';
}
$true. = $comma. $v;
$comma = ', ';
}
$true = Str_replace (', ', ', $true);
if (!preg_match ('/^[x80-xff_a-za-z0-9]+$/', $true)} {
echo "<script>alert ('!!! of special symbols not allowed ');</script> ";
exit;
}
if (!empty ($leng)) {
echo <script>alert (' A label can only be 6 characters!!! ');</script> ";
exit;
}