标签:example tps url ref ret blog utils loading style
function replaceURLWithHTMLLinks(text) { /* Example: >>> GateOne.Utils.replaceURLWithHTMLLinks(‘Downloading http://foo.bar.com/some/file.zip‘); "Downloading <a href="http://foo.bar.com/some/file.zip">http://foo.bar.com/some/file.zip</a>" */ var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; return text.replace(exp,"<a href="+$1+">$1</a>"); }
原:http://www.cnblogs.com/rubylouvre/p/3480013.html
标签:example tps url ref ret blog utils loading style
原文地址:http://www.cnblogs.com/daysme/p/6547841.html