package zfc; public class Zfc { public static void main(String[] args)
{
//判断手机号格式是否合法
String text = "15851678259";
String bj = "1{1}\\d{10}";
if(text.matches(bj))
{
System.out.println("手机号合法");
}
else
{
System.out.println("手机号不合法");
}
} }
package zfc; public class Zfc { public static void main(String[] args)
{
//判断手机号格式是否合法
String text = "15851678259";
String bj = "1{1}\\d{10}";
if(text.matches(bj))
{
System.out.println("手机号合法");
}
else
{
System.out.println("手机号不合法");
}
} }