Java && js正则表达式收集(随时更新)

一、邮箱格式正则校验

1、Java正则验证邮箱

public static void main(String[] args) {
        String regEx1 = "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";
        Pattern p = Pattern.compile(regEx1);
        Matcher m = p.matcher("test");
        if(m.matches()){
            System.out.println(true);
        }else{
            System.out.println(false);
        }
    }

2、JS正则验证邮箱

var reg= /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
var mail = 'test@1.co';
console.log(reg.test(mail));

 

 

 

参考链接:https://blog.csdn.net/a913858/article/details/82999890

 

posted @ 2020-08-19 18:09  江云风  阅读(174)  评论(0编辑  收藏  举报
// 点击-心形效果