【发布时间】:2011-08-11 13:39:38
【问题描述】:
我有一个类似的字符串
$string = ">xyz, >abc hi there and also hi to >nrm";
我想查找出现在“>”符号旁边的所有单词 例如在上面的字符串中,它将返回所有单词 xyz、abc 和 nrm
我尝试了一些方法,但没有任何结果
帮帮我,提前谢谢
【问题讨论】:
标签: php regex preg-match-all
我有一个类似的字符串
$string = ">xyz, >abc hi there and also hi to >nrm";
我想查找出现在“>”符号旁边的所有单词 例如在上面的字符串中,它将返回所有单词 xyz、abc 和 nrm
我尝试了一些方法,但没有任何结果
帮帮我,提前谢谢
【问题讨论】:
标签: php regex preg-match-all
您可以执行以下操作:
preg_match_all("/>(\w+)/", $string, $matches);
// $matches[1] contains the matches you want.
【讨论】: