php 中正则表达式判断输入的是否是邮箱
php
header ( "Content-Type: text/html; charset=UTF-8" );
$reply = "";
if ( isset($_POST["emphp 中正则表达式判断输入的是否是邮箱
php
header ( "Content-Type: text/html; charset=UTF-8" );
$reply = "";
if ( isset($_POST["email_address"]) )
{
$email_address = $_POST["email_address"];
$pattern =
"/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/ i";
if ( preg_match( $pattern, $email_address ) )
{
$reply = "您输入的电子邮件地址合法\n";
$user_name = preg_replace( $pattern ,"$1",
$email_address );
$domain_name = preg_replace( $pattern ,"$2",
$email_address );
$reply .= "用户名:".$user_name."
\n";
\n\n";
$reply .= "域名:".$domain_name."
}
else
{
}
}
?>
$reply = "您输入的电子邮件地址不合法";
php中正则表达式判断输入的是否是邮箱 来自淘豆网m.daumloan.com转载请标明出处.