正则限制输入数字,范围0-5,可包含小数(小数点后允许有两位数字)

572 阅读1分钟
const reg = /^([0-4](\.\d{1,2})?)$|(5(\.0{1,2})?)$/

image.png

在线正则测试