jookyboi
3/30/2011 - 3:41 AM

Linkify urls in plain text.

Linkify urls in plain text.

// from: http://stackoverflow.com/questions/37684/replace-url-with-html-links-javascript
function replaceURLWithHTMLLinks(text) {
  var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
  return text.replace(exp,"<a href='$1'>$1</a>"); 
}