api - PHP Twitter replace link and hashtag with real link -
i looping on json response twitter api. each api response gives me tweet similar to:
hi name @john, , love #soccer, visit me
i trying replace @john
, , insert <a href=http://twitter.com/john>@john</a>
comma (,
) after @john
, problem.
how replace dots, commas, etc before , after tag?
$str = preg_replace("/@(\w+)/i", "<a href=\"http://twitter.com/$1\">$0</a>", $str);
Comments
Post a Comment