Possible Duplicate:
How to extract text from Link in Javascript?
I want to extract a hyperlink in a message. I thought it should be done by regular expressions and then surrounded with a a-tag. But how to do a regular expression that extracts a link from a message?
Here's my incomplete attempt:
var str = ' Disappointing Usability http://t.co/wkTFYhQq';
var pattern = /http:///w{1,100}/i
var str2 = pattern.exec(str);
alert(str2);