62,074
社区成员
发帖
与我相关
我的任务
分享
Regex re = new Regex("^\d+(.\d{1,2})?$");
^[0-9]+(.[0-9]{1,2})?$
Regex re = new Regex("^(\\d)+\\.(\\d){2}$"); //只能验证验证小数点后两位 如:23.21, 0.23,0.00 等 不能验证 0,12.0,23.312等
/**
* 验证浮点数
*/
function checkTextDataForFLOAT(strValue)
{
var regTextFloat = /^(-)?(\d)*(\.)?(\d)*$/;
return regTextFloat.test(strValue);
}
/**
* 验证数字
*/
function checkTextDataForNUMBER(strValue)
{
var regTextNumber = /^(\d)*$/;
return regTextNumber.test(strValue);
}