📌  相关文章
📜  电子邮件和移动设备的正则表达式 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:23.648000             🧑  作者: Mango

代码示例1
$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";
}