题解 | #邮箱验证#
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.next();
String emailMatcher="[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+";
//write your code here......
System.out.print(str.matches(emailMatcher) ? "邮箱格式合法" : "邮箱格式不合法");
//巧妙运用正则判断————matches(),使输入的字符串直接与正则表达式进行比较
//学习到了正则表达式的判断函数matches()
}
}