My code is:
$user_patt = "/^[A-Za-z0-9]{8,20}$/";
however when I use the preg_match
to validate the format:
if (preg_match("/user/i", $field)) {
if (!preg_match($user_patt, $value)) {
$error_array[] = "$value is an invalid $field";
}
}
Then I keep getting an error for registering a name such as Granted42. Did I miss something?