JavaScript 正则表达式判断是否有小数点 1、定义匹配规则 var rep=/[.]/; 2、定义需要验证的数据。 var data=1.5; 3、进行判断,返回值为true或false rep.test(discountvalue);