替代全部:.replace(/#/g,"/")
替代第一个:.replace("#","/")
var regS = new RegExp(keyWords, "g");
var reg = ‘<i style="color:red">‘ + keyWords + ‘</i>‘;
data = data.replace(regS, reg);
时间: 2024-10-18 11:24:29
替代全部:.replace(/#/g,"/")
替代第一个:.replace("#","/")
var regS = new RegExp(keyWords, "g");
var reg = ‘<i style="color:red">‘ + keyWords + ‘</i>‘;
data = data.replace(regS, reg);