public static void main(String[] args){String phone = "18312341234";if(!phone.matches("\\d{7,11}")){//xx.matches("^\\d{7,11}$");限制开头结尾System.out.println("报错xxxxxxxxx");}System.out.println("successxxxxxxxxx");
}
public static void main(String[] args){String phone = "18312341234";if(!phone.matches("\\d{7,11}")){//xx.matches("^\\d{7,11}$");限制开头结尾System.out.println("报错xxxxxxxxx");}System.out.println("successxxxxxxxxx");
}