我有一个像
这样的字符串$string = ">xyz, >abc hi there and also hi to >nrm";
我想找到“>”旁边出现的所有单词标志 例如,在上面的字符串中,它将返回所有单词xyz,abc和nrm
我尝试了一些方法,但没有任何结果
帮助我们,并提前致谢
答案 0 :(得分:3)
您可以执行以下操作:
preg_match_all("/>(\w+)/", $string, $matches);
// $matches[1] contains the matches you want.