Hello I need to add an a href tag around a link in a tweet in php for example if I have tweet like this:
@username tweet body message http://t.co/sfr34s5
I need to turn this into this with php:
@username tweet body message <a href="http://t.co/sfr34s5">http://t.co/sfr34s5</a>
I think this can be done using preg_replace and I have something similar which already wraps a link around the twitter @username as below:
$tweet= preg_replace('/@([a-z0-9_]+)/i', '<a href="http://twitter.com/$1" target="_blank">@$1</a>', $tweet);
How do I edit the regex part of this to put an a tag around the urls in tweets that appear?