var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
return this.replace(reg, '<a target=_blank href="$1$2">$1$2</a>');

识别并转换为超链接。

整理自:http://www.jb51.net/article/43124.htm

Related Posts: JavaScript-链接自动转换 :