日期:2014-05-16 浏览次数:20413 次
var aa="<b style='sdgds dgjdsg'>我爱</b><a href='rrr'>她</a><b style='sdgds dgjdsg'>呀</b>";
var aa=aa+'<b style="sdgds dgjdsg">她爱</b><a href="rrr">我</a><b style="sdgds dgjdsg">呀</b>';
var reg1 = /\s+style=(?:'
------解决方案--------------------
")+[^>]+(?:'
------解决方案--------------------
")/gi;
var reg2 = /<a+[^>]*>
------解决方案--------------------
<\/a>/gi
var bb = aa.replace(reg1,function(){
return ''
})
bb.replace(reg2,function(){
return ''
})
var aa="<b style='sdgds dgjdsg'>我爱</b><a href='rrr'>她</a><b style='sdgds dgjdsg'>呀</b>";
var aa=aa+'<b style="sdgds dgjdsg">她爱</b><a href="rrr">我</a><b style="sdgds dgjdsg">呀</b>';
var reg1 = /\s+style=(?:'
------解决方案--------------------
")+[^>]+(?:'
------解决方案--------------------
")
------解决方案--------------------
<a+[^>]*>
------解决方案--------------------
<\/a>/gi;
var bb = aa.replace(reg1,function(){
return ''
});
console.log(bb);
var aa="<b style='sdgds dgjdsg'>我爱</b><a href='rrr'>她</a><b style='sdgds dgjdsg'>呀</b>";
aa=aa+'<b style="sdgds dgjdsg">她爱</b><a href="rrr">我</a><b style="sdgds dgjdsg">呀</b>';
alert(aa.replace(/<(\w+)[^>]*>/g, "<$1>"))
var aa="<b style='sdgds dgjdsg'>我爱</b><a href='rrr'>她</a><b style='sdgds dgjdsg'>呀</b>";
var reg = /(<\w+[^>]+?)style\s*=\s*('
------解决方案--------------------
"
------解决方案--------------------
).*?\2([^>]*?>)/ig
aa = aa.replace(reg,function(){
return arguments[1] + arguments[3];