I can see this question has been asked many times before, but I just can't get my particular implementation to work, so wondered if someone can enlighten me of the error of my ways?!
I have a Twitter feed onto my site and (using PHP) want to replace any URLs mentioned in Tweets with the relevant HTML anchor and HREF.
An example Tweet could be ...
No BlackBerry 10 smartphones till Q4 2012: A bad day for BlackBerry fans today after it was revealed that due to... http://t.co/lNEdUUef
I am using the following preg_replace in attempt to alter this ...
$tweet2 = preg_replace('#http://\S+#i', '<a href="$0">$0</a>', $tweet);
Unfortunately this isn't making a blind bit of difference and the text is left unchanged.
Can someone spot what I've done wrong and advise accordingly?