Home >Backend Development >PHP Tutorial >An example of regular expression for php mailbox detection

An example of regular expression for php mailbox detection

WBOY
WBOYOriginal
2016-07-25 08:58:251069browse
This article introduces a piece of PHP code that uses regular expressions to match mailboxes. Friends in need can refer to it.

php email regular expression example:

<?php
/** 
 * 邮箱地址正则表达式
 * edit bbs.it-home.org
 */  
$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