Home  >  Article  >  php教程  >  邮箱正则表达式实现代码(针对php)

邮箱正则表达式实现代码(针对php)

WBOY
WBOYOriginal
2016-06-13 11:46:181159browse

一直都在网上抄别人写的电话,邮箱正则表达式,今天稍微有点闲情,把一直想自己写个这样的表达式的心愿给完成:

复制代码 代码如下:


/**
 * 邮箱地址正则表达式
 */
$preg = '/^(\w{1,25})@(\w{1,16})(\.(\w{1,4})){1,3}$/';
$b = 'ffgddayasdadasdf@gmialsdfsdfasd3.com.cn.org';
if(preg_match($preg, $b)){
    echo "匹配到了";
}else{
    echo "没有匹配到";
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn