System.out.println(Pattern.matches("(\\d{0,8}[1-9]{1})|(\\d{0,7}[1-9]{1}\\d{0,1})|(\\d{0,6}[1-9]{1}\\d{0,2})|(\\d{0,5}[1-9]{1}\\d{0,3})|(\\d{0,4}[1-9]{1}\\d{0,4})|(\\d{0,3}[1-9]{1}\\d{0,5})|(\\d{0,2}[1-9]{1}\\d{0,6})|(\\d{0,1}[1-9]{1}\\d{0,7})|([1-9]{1}\\d{0,8})","999999999"));原文链接:https://www.f2er.com/regex/362536.html