参考链接: JavaScript RegExp对象 var newStr = oldStr.replace(new RegExp(replaceStr,'gm'),''); replaceStr为要替换掉的字符串