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