搜索内容高亮显示
var str = "aaa的大收拾收拾的大收拾收拾得到的淡淡的洒事实上";
var sub = '的';
var rep = 'new';
var newStr;
var reg = new RegExp(sub,"g");
console.log(str.replace(reg,rep))
function getNewStr(originStr,subStr,replacement){
newStr = originStr.replace(subStr,replacement);
if(newStr.match(subStr)){
getNewStr(newStr,subStr,replacement);
}
console.log(14)
return newStr
}
var objStr = getNewStr(str,sub,rep);
console.log(objStr)
版权所有©凉城丶旧梦,转载请注明出处!