js正则匹配问题
tobeno1
2009-10-29
var totalQuotaWithUnit = '';
totalQuotaWithUnit = totalQuotaStatics/1024+'GB'; alert(totalQuotaStatics/1024); alert(totalQuotaWithUnit.match(/^\d+(\.\d{2})*$/)); 得到的结果是:200.3698532,null 哪位大哥能说一下什么原因么,我自认是没有错的。 |
|
szcjlssx
2009-11-08
totalQuotaWithUnit以GB结尾
正则表达式 /^\d+(\.\d{2})*$/ $表示字符串结尾,上面正则表达式要求,以.\d{2}.\d{2},即点数字的形式结尾 应该这样吧: /^\d+(\.\d{2})*GB$/ |