正则表达式验证email格式

String email = "fancq@tedu.cn";
        /*
         * 验证email格式的正则表达式
         * \w+@\w+(\.[a-zA-Z]+)+
         */
        String regex = "\\w+@\\w+(\\.[a-zA-Z]+)+";
        boolean match = email.matches(regex);
        if(match) {
            System.out.println("是邮箱");
        }else {
            System.out.println("不是邮箱");
        }

 

posted @ 2018-11-08 11:33  温柔的陌先生  阅读(445)  评论(0)    收藏  举报