网络编程 
首页 > 网络编程 > 浏览文章

php email邮箱正则

(编辑:jimmy 日期: 2025/5/3 浏览:3 次 )

1.验证email:

 < "/^[a-z]([a-z0-9]*[-_\.]",$email)){ 
echo “Your email address is correct!”;} 
   else{ 
echo "Please try again!"; 
} 
"htmlcode">
$str = '';
$isMatched = preg_match('/^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}$/', $str, $matches);
var_dump($isMatched, $matches);

匹配Email邮箱格式的正则表达式:

/^[a-z]([a-z0-9]*[-_]"htmlcode">
<"/([a-z0-9]*[-_\.]"; 
preg_match_all($pattern,$str,$emailArr); 
return $emailArr[0]; 
} 
$emailstr = "9999@qq.com.cn俺不是米vi地方就开iid邮件列表:fuyongjie@163.com 和hh@qq.com;.;;,fuyongjie.100@yahoo.com,fu-1999@sina.com"; 
$emailArr = getEmail($emailstr); 
echo "<pre>"; 
print_r($emailArr); 
echo "</pre>"; 
?> 


打印如下:
Array
(
[0] => 9999@qq.com.cn
[1] => fuyongjie@163.com
[2] => hh@qq.com
[3] => fuyongjie.100@yahoo.com
[4] => fu-1999@sina.com
)
3.比较:第2里的正则里没有了第1的^和$;

上一篇:php preg_match_all结合str_replace替换内容中所有img
下一篇:php获取地址栏信息的代码
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。