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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -