题解 | #邮箱验证#
邮箱验证
https://www.nowcoder.com/practice/8f908eeee4aa412ca88304f0acbaa1f9
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); String emailMatcher = "[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+"; System.out.println(str.matches(emailMatcher)?"邮箱格式合法":"邮箱格式不合法"); } }