http://www.cnblogs.com/wupeiqi/articles/5237672.html
test 判断字符串是否符合规定的正则
exec 获取匹配的数据
例子:
test例子
rep = /d+/; //只要有数字就返回true
rep.test("asdkfasdkf9999")
true
rep.test("asdkfasdkf")
false
rep = /^d+$/; //全部是数字返回真
exec例子
rep = /d+/;
str="wangn_88_skjffaf_33";
rep.exec(str);
["88", index: 6, input: "wangn_88_skjffaf_33", groups: undefined]
我们看到只会过滤前面一个数字,不会过滤33