📜  js 将内容中的 url 转换为链接 - Javascript 代码示例
📅  最后修改于: 2022-03-11 15:04:25.303000             🧑  作者: Mango
代码示例1
function convert(text)
{
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var text1=text.replace(exp, "$1");
var exp2 =/(^|[^\/])(www\.[\S]+(\b|$))/gim;
return text1.replace(exp2, '$1$2');
}