验证邮箱:'.'和@符号不能是在第一位。

解决方案 »

  1.   

            String content = "[email protected]";
            String pattern = "[^\\.^@]+@[^\\.]+.com";
            Matcher matcher = Pattern.compile(pattern).matcher(content);
            if(matcher.matches()){
                System.out.println("合法邮箱地址");
            }else{
                System.out.println("非法邮箱地址");
            }
      

  2.   


            String content = "[email protected]";
            String pattern = "[^\\.^@]+@[^\\.]+\\.com";
            Matcher matcher = Pattern.compile(pattern).matcher(content);
            if(matcher.matches()){
                System.out.println("合法邮箱地址");
            }else{
                System.out.println("非法邮箱地址");
            }
    更正一下