\" sign" />
开发者

php preg_match_all custom pattern

开发者 https://www.devze.com 2023-03-27 23:06 出处:网络
I have one string like $string = \">xyz, >abc hi there and also hi to >nrm\"; I want to find all occ开发者_Python百科urrences of words which are next to \">\" sign

I have one string like

$string = ">xyz, >abc hi there and also hi to >nrm";

I want to find all occ开发者_Python百科urrences of words which are next to ">" sign for example in above string it would return all words xyz, abc and nrm

I tried some ways but no any result

Help me guys and thanks in advance


You can do the following:

preg_match_all("/>(\w+)/", $string, $matches);
// $matches[1] contains the matches you want.

See also: Example of it in action on Ideone

0

精彩评论

暂无评论...
验证码 换一张
取 消