有人可以向我解释吗?这是我的代码:
$regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+'
. '(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/';
if (preg_match($regex, $email)) {
echo $email . " is a valid email. We can accept it.";
} else {
echo $email . " is an invalid email. Please try again.";
}
如果我以这个正则表达式为例:
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)↪*(\.[a-z]{2,3})$
或我得到的另一个不同的正则表达式:
preg_match() [function.preg-match]: No ending delimiter '^' found
如果我使用filter_var('some_regular_expression', FILTER_EMAIL_VALIDATOR)
的电子邮件asd!qwe@gmail.com
是有效的???