Chinaunix

标题: preg_match_all 問提 [打印本页]

作者: shinhrn8    时间: 2015-10-19 17:01
标题: preg_match_all 問提
$pattern = '/([a-zA-Z0-9]+[_.+-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-.]?)+[a-zA-Z0-9]+/';
//不行
$emailstr=' a@b.com 123456789012345678 b@b.com ';
if (preg_match_all($pattern, $emailstr, $matches)) foreach($matches[0] as $email) echo $email,'=Ans 1<BR>';

//可以
$emailstr=' a@b.com 12345678901234567 b@b.com ';
if (preg_match_all($pattern, $emailstr, $matches)) foreach($matches[0] as $email) echo $email,'=Ans 2<BR>';

難道有字數限制???
作者: shinhrn8    时间: 2015-10-23 11:53
沒人要回答??




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2