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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -