1 var reg1 = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/; //不限制小数位数 2 3 var reg2 = /^[+-]?((\d*(\.\d{1,})$)|(\d+$))/; //可限制小数位数 {1,} 小数时,必须1位以上小数 4 5 var reg3 = /^[+-]?((\d*(\.\d{1,})$)|(\d{1,3}$))/; //可限制整数位数 {1,3} 整数时,1到3位整数
标签:限制,数字,小数点,+-,整数,var,小数位,位数 From: https://www.cnblogs.com/little-sheep9/p/16984647.html引用:https://blog.csdn.net/qq_37899792/article/details/89879566