请教用正则表达式去除数字和Xx外的字符
var sdf = " 2345234523 ";
var re = new RegExp( "[^0-9xX] ", " ");
sSFZH = re.exec(sdf );
这么写出错
请教正确方法
------解决方案--------------------用replace
<script language= "javascript ">
var sdf = " 2345234523 ";
re = /[^0-9xX]/g;
sSFZH = sdf.replace(re, " ");
alert(sSFZH);
</script>