Skip to content

Instantly share code, notes, and snippets.

@bradfordw
Forked from jbynum/gist:599440
Created September 27, 2010 17:52
Show Gist options
  • Select an option

  • Save bradfordw/599482 to your computer and use it in GitHub Desktop.

Select an option

Save bradfordw/599482 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 ])([a-z]+:\/\/\S+[^ \.{1,3}$])#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