作者 主題: preg_match_all 問題  (閱讀 3029 次)

0 會員 與 1 訪客 正在閱讀本文。

shinhrn

  • 懷疑的國中生
  • **
  • 文章數: 31
    • 檢視個人資料
preg_match_all 問題
« 於: 2015-10-19 15:51 »
$emailstr=' b@b.com 123456789012345678 b.bb@bbb.com ';
$pattern = '/([a-zA-Z0-9]+[_.+-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-.]?)+[a-zA-Z0-9]+/';
if (preg_match_all($pattern, $emailstr, $matches)){
   foreach($matches[0] as $email) {
      echo $email,'<BR>';
   }
}
找不出匹配???


$emailstr=' b@b.com 12345678901234567 b.bb@bbb.com ';
就可以...請問各位大大這是什麼原因阿?