您现在的位置是:首页 > 电脑技术查询 > web开发

关于过滤的有关问题

编辑:chaxungu时间:2022-10-02 23:20:59分类:web开发

关于过滤的问题
有串值 xxx[123fda];vvvvv <sd23a> , 请问有什么方法能把[]中间的值过滤掉,最后结果是xxx;vvvvv吗? 在js中

------解决方案--------------------
<script type= "text/javascript ">
<!--
var str = 'xxx[123fda];vvvvv <sd23a> ';
str = str.replace(/\[[^\]]*\]| <[^\> ]*> /g, " ");
alert(str);
//-->
</script>