regular expression for email and mobile

Solutions on MaxInterview for regular expression for email and mobile by the best coders in the world

showing results for - "regular expression for email and mobile"
Isaac
01 Jun 2019
1$email=$_POST['email'];
2
3$emailPattern = '/^\w{2,}@\w{2,}\.\w{2,4}$/'; 
4$mobilePattern ="/^[7-9][0-9]{9}$/"; 
5
6if(preg_match($emailPattern, $email)){
7    echo "Email Success!";
8} else if(preg_match($mobilePattern, $email)){
9    echo "Mobile Success!";
10} else {
11    echo "Invalid entry";
12}
13