目标
我想< >
将字符串特殊字符之间的所有电子邮件检索到电子邮件数组中
$list = '"momo rabit" <[email protected]>, "youn" <[email protected]>, "yourmail" <[email protected]>, "yovan" <[email protected]>, "popol" <[email protected]>';
我试过的
基于这个答案,它应该可以工作。
$list = htmlspecialchars($list);
preg_match_all("/<(.*?)>/", $list, $list_step);
var_dump($list_step); // Return empty arrays
我也试过没有成功
答案很简单。该htmlspecialchars
转换<
和>
以<
和>
。因此,要么更改正则表达式,要么删除该函数。
$list = '"momo rabit" <[email protected]>, "youn" <[email protected]>, "yourmail" <[email protected]>, "yovan" <[email protected]>, "popol" <[email protected]>';
//$list = htmlspecialchars($list);
preg_match_all("/<(.*?)>/", $list, $list_step);
var_dump($list_step); // Return empty arrays
演示:https : //3v4l.org/VUY1U
选择:
$list = '"momo rabit" <[email protected]>, "youn" <[email protected]>, "yourmail" <[email protected]>, "yovan" <[email protected]>, "popol" <[email protected]>';
$list = htmlspecialchars($list);
preg_match_all("/<(.*?)>/", $list, $list_step);
var_dump($list_step); // Return empty arrays
演示:https : //3v4l.org/gI07A
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句