参考链接:

JavaScript RegExp对象


var newStr = oldStr.replace(new RegExp(replaceStr,'gm'),'');

replaceStr为要替换掉的字符串


在js中实现replaceAll的方法

相关文章: