emai正则,该怎么解决

WBOY
Release: 2016-06-13 10:58:58
Original
808 people have browsed it

emai正则
这样写怎么匹配不了邮件
function check($str){
$re='/([a-z0-9_-]+)@\1(\.[a-z0-9_-])+/i';
preg_match($re,$str,$result);
return $result;
}
var_dump(check([email protected]'));
?>
------最佳解决方案--------------------
按照你的正则方式,[email protected]
------其他解决方案--------------------
[email protected]\1是后向引用啊当然会出问题

$re='/([a-z0-9_-]+)@([a-z0-9_-]+)(\.([a-z0-9_-])+)+/i';


------其他解决方案--------------------

引用:
按照你的正则方式,[email protected]
[email protected]!如果你知道你主要匹配哪些邮箱后缀就好办
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!