DDR爱好者之家 Design By 杰米

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的^和$;

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米