日期:2014-05-16  浏览次数:20327 次

正则表达式 js
background-color: rgb(238, 238, 221);获取一段html代码转移到另一html中,想把 所有背景颜色去除,字符串操作时
string.replace(new RegExp(/(background-color: rgb(238, 238, 221);)/g),"");无效,好像是里边rgb(238, 238, 221)的括号的作用吧,怎么也能起作用,望 正则表达式 大人 指点指点

------解决方案--------------------
//background-color: rgb(238, 238, 221); 替换成空
html=html.replace(/background-color:\s*rgb\(238, 238, 221\);/ig,"");