var textR=‘@游https://www.pc.com.cn/vPTX/2020/312@游客11:1231231https://www.pc.com.cn/vPTX/2020/3122@游客https://www.pc.com.cn/vPTX/2020/31211:12312312@游客11:12312312@游客11:12312312‘;
var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
textR = textR.replace(reg, "<a href=‘$1$2‘>$1$2</a>");
console.log(textR)
2020-04-04-JS正则表达式给内容里所有的url加上a标签
原文:https://www.cnblogs.com/cnsyear/p/12632480.html