正则匹配
function replaceURLWithHTMLLinks(text) { var exp = /((https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/i; return text.replace(exp,"<a href='$1'>$1</a>"); }