Email正则表达式验证

 在做邮箱验证的时候,进行简单的整理:

string emailStr =  @"/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/";

Regex emailReg = new Regex(emailStr);

 if (emailReg.IsMatch(txtEmailAddress.Text.Trim())){
    lblResult.Text = "输入的是有效的邮件地址格式";
}

参考地址:https://jingyan.baidu.com/article/cbcede072b818302f40b4d83.html

posted on 2018-02-12 14:14  zhucheng88  阅读(1251)  评论(0编辑  收藏  举报

导航

Document