日期:2014-05-16  浏览次数:20340 次

求个js 匹配正则
"["22","6","48","19","20","21"]" 只匹配出数字 放到一个数组中

------解决方案--------------------
<script type="text/javascript">
var reg=/\d+/g;
var a="['22','6','48','19','20','21']";
var b=a.match(reg);
alert(b);
</script>
这样?
------解决方案--------------------
JScript code
var str = '"["22","6","48","19","20","21"]"';
var ar = str.match(/\d+/g);