验证email地址的正则表达式

2021-10-27 15:11:32 浏览数 (1)

代码语言:javascript复制
$email = "test@ansoncheung.com";
if (preg_match('/^[^0-9][a-zA-Z0-9_] ([.][a-zA-Z0-9_] )*[@][a-zA-Z0-9_] ([.][a-zA-Z0-9_] )*[.][a-zA-Z]{2,4}$/',$email)) {
    echo "Your email is ok.";
} else {
    echo "Wrong email address format";
}

0 人点赞