//验证正数和0
var re = /^\d+(?=\.{0,1}\d+$|$)/
//验证浮点数
var re2=/^(-?\d+)(\.\d+)?$/
re.test('0.21');
re.test('-0.21');
re2.test('-0.21');
var re = /^\d+(?=\.{0,1}\d+$|$)/
//验证浮点数
var re2=/^(-?\d+)(\.\d+)?$/
re.test('0.21');
re.test('-0.21');
re2.test('-0.21');