var str = '<span>testString</span>地(我)';
我想变成这样 testString地
下面是我写的代码:但是错了。
var reg = '/<(.*)>/?';
var str = '<span>testString</span>地(我)';
var newStr = str.replace(reg,'');
var ger = '/\\(.*\\)/?';
var newStrs = newStr.replace(ger,'');
document.write(newStrs);
------解决方案--------------------
<script>
str = "<span>testString</span>地(我)123(222)ABC(D)";
str = str.replace(/<.*?>/g,"");
str = str.replace(/\(.*?\)/g,"");
alert(str);
</script>
------解决方案--------------------
- JScript code
var str = "<span>testString</span>地(我)123(222)ABC(D)"; alert(str.replace(/<.*?>|\(.*?\)/g,""));