日期:2014-05-20 浏览次数:21130 次
(([1-9][\d]*)(\.[\d]{1,4})?)
------解决方案--------------------
(0\.[\d]{1,4})
String regex = "(0*[.]((?!0)\\d
------解决方案--------------------
(?!00)\\d{2}
------解决方案--------------------
(?!000)\\d{3}
------解决方案--------------------
(?!0000)\\d{4}))
------解决方案--------------------
(\\d*[1-9]\\d*([.]\\d{1,4})?)";
String[] data = {"0", "0000", "00.0000", "0.1000", "0.0100", "0.0010", "0.0001",
"0.05", "1.0000", "10.0000", "10.0100", "10.25", "100", "123456"};
for (String s : data) {
System.out.printf("%s:%b\n", s, s.matches(regex));
}