I wrote this regex
for checking the input number from my form:
if (!preg_match("/^0\d{10}+|^9\d{9}+/",$_POST['number'])){
echo "Error";
}else{
echo "Ok";
}
this code will check the minimum length but if length is more than 10 or 9 characters, this regex cannot work !
What should I do ? should I check with strlen
after Regex or I can limit the maximum length ?
UPDATE:
the string length should be exactly 10 characters if start with 0 and should be exactly 9 characters if start with 9, and should return false on another ways (more or less length, start with different numbers and ...)