var str="是吗@Test1:我觉得你说的很对@Test:学无止境"; var r=str.match(/@.*?:/ig); for (var index = 0; index < r.length; index++) { str=str.replace(r[index],"<a>"+r[index]+"</a>"); } console.log(str);
正则匹配指定字符之间的内容,并替换(多个匹配替换)
猜你喜欢
转载自www.cnblogs.com/sunshine-wy/p/9295805.html
今日推荐
周排行