My client ask me to add new a rule to the username to his website login. Therefore I've tried the following code.
$userid = "12345678SM"; //format of the username
$check="/^[0-9]+[S].[M]{10}$/i";
$check2="/^[0-9]+[F].[M]{10}$/i";
print($name);
if(!preg_match($check,$userid) || !preg_match($check2,$userid)) {
print('The user id is invalid');
}
However, even though I entered the correct format of the username it's printing the error. I've actually used this code sometimes ago and worked but here I don't understand why it's not working. Could anyone please help me out of this ?
FYI: Format of the username should be 7 digits and 2 selected alphabet characters eg: SM or FM