Skip to content

Instantly share code, notes, and snippets.

@jbynum
Created September 27, 2010 17:31
Show Gist options
  • Save jbynum/599440 to your computer and use it in GitHub Desktop.
Save jbynum/599440 to your computer and use it in GitHub Desktop.
$text = $tweet->title;
$text = preg_replace("#(^|[\n ])@([^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://www.twitter.com/\\2\" >@\\2</a>'", $text);
$text = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t<]*)#ise", "'\\1<a href=\"\\2\" >\\2</a>'", $text);
$text = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#ise", "'\\1<a href=\"http://\\2\" >\\2</a>'", $text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment