zoukankan      html  css  js  c++  java
  • Regular Expression Validator for checking different kinds of email address

    来源:http://www.strivingprogrammers.com/articles/10-regular-expression-validator-for-checking-different-kinds-of-e-mail-address.aspx

    原文:

    I was working on Regular Expression Validator and found a very strong expression for checking validity of all kinds of e-mail addresses. So here i am sharing it with you guys:

    Here's the expression:

             

    ^([\w\d\-\.]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$




    Here's the way it can be used in ASP.NET Regular Expression Validator:


    <asp:RegularExpressionValidator runat="server" ID="EmailAddress" Display="Dynamic" ControlToValidate="txtFirstName" ErrorMessage="Please enter a valid e-mail address" ValidationExpression="^([\w\d\-\.]+)@{1}(([\w\d\-]{1,67})|([\w\d\-]+\.[\w\d\-]{1,67}))\.(([a-zA-Z\d]{2,4})(\.[a-zA-Z\d]{2})?)$" ValidationGroup="CreateUserForm">*</asp:RegularExpressionValidator>



    Matches: name@domain.com | name@sub-domain.com.au | name@sub1.sub2.domain | name@organization.co.uk | name@domain.tv | name@domain.four | name@mailbox.com.us

    Non-Matches: www.domain.com | name@.com | name@domain..com | name@anything@.com | name@com

  • 相关阅读:
    Java中XML的四种解析方式(二)
    Java中XML的四种解析方式(一)
    Java反射机制
    创建线程的三种方式(Thread、Runnable、Callable)
    GBK和UTF-8的区别
    selenium的其他方法
    selenium
    XPath
    mysqldump / MySQL 备份与恢复语句
    MySQL 增删改查语句/SELECT INSET INTO UPDATE
  • 原文地址:https://www.cnblogs.com/chjf2008/p/2250666.html
Copyright © 2011-2022 走看看