Create link from text
function createLink(text) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i; text = text.replace(exp, "<a href='$1' target='_blank'>$1</a>"); return text; }