/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function replaceURLWithHTMLLinks(text) { // this looks for urls in html and makes them links // I apologize in advance var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; return text.replace(exp, "<a href='$1'>$1</a>"); }
Comments
