Here’s a quick tip. If you have text that contains urls (i.e. tweets) and want the urls in the text to appear as actual links via HTML, use the following RegEx:
[sourcecode lang=”javascript”]
var message = “Here is some tweet text. Check out: http://www.google.com";
var exp = /(b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
message = message.replace(exp, “$1”);
[/sourcecode]
Source: http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links