一条正则式的话,应该需要用到非捕获分组吧,不过js只支持前瞻。
所以取个巧吧:
var str='I\'m <span style="font-family:\'微软雅黑\';font-family2:\'abc\';font-size:20px;" >I\'m demo</span>测试测试I\'m demo"\'我也会被换掉\'"....'; var result = str.replace(/"([^"]*)"/g, function(word){ //console.log('>',word); return word.replace(/'/g, '');