let reg = /^(\d+)(.\d{0,2})?$/
str.match(reg)或者reg.test(str)
正则匹配小数点后最多两位
最新推荐文章于 2024-06-26 15:11:14 发布
let reg = /^(\d+)(.\d{0,2})?$/
str.match(reg)或者reg.test(str)