PHP uses regular expressions to get topics and object names in Weibo, and PHP regular expressions
The example in this article describes how PHP uses regular expressions to get the topic and object names in Weibo. Share to everyone for your reference. The implementation method is as follows:
$post _content = "@jb51 and @twitter in the study of # Regular expressions with #php# # filter topics and object names"; $tag _pattern = "/\# ([^\#|.] +) \#/";p Reg_match_all ($tag _pattern, $post _content, $tagsarr); $tags = Implode (', ', $tagsarr [1]); $user _pattern ="/\@ ([ a-za-z0-9_]+)/"; $post _content = Preg_replace ($user _pattern, ' @${1} ', $post _content); $post _content = Preg_replace ($ Tag_pattern, ' #${1}# ', $post _content);
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1034536.html www.bkjia.com true http://www.bkjia.com/PHPjc/1034536.html techarticle PHP uses regular expressions to get topics and object names in Weibo, and PHP regular expressions This article describes how PHP uses regular expressions to get the topic and object names in Weibo. Share to ...