/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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>"); }
URL: http://stackoverflow.com/questions/5180877/convert-text-url-into-clickable-links