https://www.jianshu.com/p/b24e5ae9e9ac
https://deerchao.cn/tutorials/regex/regex.htm
看一下这个,小数点后 几位
https://blog.csdn.net/u012468263/article/details/50621779/
String pattern = "(([1-9]{1}\\d*)|(0{1}))(\\.\\d{2})?";
System.out.println("0.2 > "+("0.2".matches(pattern)));
System.out.println("07.23 > "+("07.23".matches(pattern)));
System.out.println("7.23 > "+("07.23".matches(pattern)));
System.out.println("123.58 > "+("123.58".matches(pattern)));
System.out.println("123.589 > "+("123.589".matches(pattern)));
网友评论