var str = '<pre style="word-wrap: break-word; white-space: pre-wrap;">str</pre>'; var reg = /\<[^\>]*\>([^\<]*)\<[^\>]*\>/g; var a = str.replace(reg,function($0,$1){return $1;}); console.log(a);正则表达式,匹配出来。这个正则,试试应该没有问题的,你试试其他的语句,是不是也符合要求。。
function htmlDecode(value){ return $("<div/>").html(value).text(); }
var reg = /\<[^\>]*\>([^\<]*)\<[^\>]*\>/g;
var a = str.replace(reg,function($0,$1){return $1;});
console.log(a);正则表达式,匹配出来。这个正则,试试应该没有问题的,你试试其他的语句,是不是也符合要求。。
return $("<div/>").html(value).text();
}