public static void checkTel()
{
String tel = "16900001111";
String telReg = "1[358]\\d{9}";
System.out.println(tel.matches(telReg));
}
public static void demo()
{
String str = "b23a23456789";
String reg = "[a-zA-Z]\\d*";
boolean b= str.matches(reg);
System.out.println(b);
}
public static void checkQQ()
{
String qq = "123a454";
String regex = "[1-9]\\d{4,14}";
boolean flag = qq.matches(regex);
if(flag)
System.out.println(qq+"...is ok");
else
System.out.println(qq+"... 不合法");
}
|
|