var regex = /^\d*(\.[1-9]|\.\d[1-9])*$/ console.log(1.2,regex.test(1.2)); console.log(0.3,regex.test(0.3)); console.log(1.03,regex.test(1.03)); console.log(9.0,regex.test(9.0)); c...
var regex = /^\d*(\.[1-9]|\.\d[1-9])*$/ console.log(1.2,regex.test(1.2)); console.log(0.3,regex.test(0.3)); console.log(1.03,regex.test(1.03)); console.log(9.0,regex.test(9.0)); console.log(88,regex.test(88)); console.log(.1,regex.test(.1)); console.log(1.0,regex.test(1.0)); console.log("88",regex.test("88")); console.log("88a",regex.test("88a")); console.log("8 8",regex.test("8 8")); console.log("1.",regex.test("1.")); console.log(".1",regex.test(".1")); console.log("1.0",regex.test("1.0")); console.log("1.03",regex.test("1.03")); console.log("1.00",regex.test("1.00"));1.2 true0.3 true1.03 true9 true88 true0.1 true1 true88 true88a false8 8 false1. false.1 true1.0 false1.03 true1.00 false