I have a string that is failing to pass the below requirement:-
$uid = ca11a15e (the value called from database)
function _checkSn($uid)
{
$match1 = preg_match('/^p[a-z\d][a-z\d][1-6][a-z]\d{2}e$/',$uid);
$match2 = preg_match('/^p[a-z\d][a-z\d]school$/',$uid);
$match3 = preg_match('/^p[a-z\d][a-z\d]master$/',$uid);
$match4 = preg_match('/^p[a-z\d][a-z\d]ee01$/',$uid);
$doesMatch = ($match1 || $match2 || $match3 || $match4);
return $doesMatch;
}
Actually, what is the phase talking about? and how shall I modify it so that the $uid can pass the checking?
uid matches the pattern if it is…
For example, this would match: “p6t3h56e” (first pattern), or “p9hschool” (second).
“ca11a15e” will not match any of these because they all require a “p” at the start.
By the way, this can be shortened to:
Are all the uid’s going to start with a c? Maybe you meant this, which would match “ca11a15e” (Note the c instead of p):