日期:2014-05-16 浏览次数:20350 次
<html>
<body>
<script type="text/javascript">
var str="abc+\"ddd\\\"eee\\\'fff\\\\\"+'ggg\\\"hhh\\\'iii\\\\'+\'jkl\"+mno"
document.write(str + "<br />")
document.write(str.replace(/["'][\w\s]*["']/g,"") + "<br />")
</script>
</body>
</html>
var t="abc+\"def\"+'ghi'+jkl+'sdsd\"+\"jooio'";
alert(t);
alert(t.replace(/('(.*?)')/,'').replace(/"(.*?)"/,''));
var str="abc+\"ddd\\\"eee\\\'fff\\\\\"+'ggg\\\"hhh\\\'iii\\\\'+\'jkl\"+mno";
alert(str.replace(/\\/g,"").replace(/'[^+]*'/g,"").replace(/"[^+]*"/g,""));