package 正则表达式;
import java.util.Scanner;
public class test1 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.next();
boolean flag = s.matches("[a-z0-9]*[@][a-z0-9]*[.][a-z]*");
if(flag){ //@前面的数字@qq . com
System.out.println("输入的邮箱格式正确");
return ;
}else{
System.out.println("错误的邮箱格式!");
}
}
}
原文链接:https://www.f2er.com/regex/361647.html