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

An example of regular expression for php mailbox detection

WBOY
Release: 2016-07-25 08:58:25
Original
1077 people have browsed it
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 "未匹配";  
}
?>
Copy after login


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