I’m trying to validate a 15 digit CNIC Number (XXXXX-XXXXXXX-X) using the following code at inserting:
if (preg_match('/^([0-9]{5})[\-]([0-9]{7})[\-]([0-9]{1})+/', $rsnew['teacher_cnic'])) {
$rsnew['teacher_cnic'] = clearInput($rsnew['teacher_cnic']);
} else {
echo "Invalid CNIC";
}
But this is not working as expectedly can anyone give me some guidance