Return to Snippet

Revision: 50552
at August 26, 2011 10:10 by jfoucher


Initial Code
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>");
}

Initial URL
http://stackoverflow.com/questions/5180877/convert-text-url-into-clickable-links

Initial Description

                                

Initial Title
convert text links to clickable links

Initial Tags

                                

Initial Language
JavaScript