Answers for "regular expression for email and mobile"

0

regular expression for email and mobile

$email=$_POST['email'];

$emailPattern = '/^\w{2,}@\w{2,}\.\w{2,4}$/'; 
$mobilePattern ="/^[7-9][0-9]{9}$/"; 

if(preg_match($emailPattern, $email)){
    echo "Email Success!";
} else if(preg_match($mobilePattern, $email)){
    echo "Mobile Success!";
} else {
    echo "Invalid entry";
}
Posted by: Guest on December-09-2020

Code answers related to "regular expression for email and mobile"

Code answers related to "Javascript"

Browse Popular Code Answers by Language