WHAT IS EMAIL VALIDATION'S REGULAR EXPRESSION IN ASP.NET

Andrew Deniel

Total Post:5

Points:25
Posted by  Andrew Deniel
 1515  View(s)
Ratings:
Rate this:
  1. Andrew Deniel

    Post:5

    Points:25
    what is email validation's regular expression in asp.net

    By using below reg expression we can validate email id

    ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$

    "^[_a-z0-9-]+": start with any underscore or alphanumeric one or more then one alfanumaric word
    "(\.[_a-z0-9-]+)*@":any dot(.) or alphanumeric zero times or more the zero and a @ sign
    "[a-z0-9-]+":one or more alphanumeric 
    "(\.[a-z0-9-]+)*": zero or more dot alphanumeric or -(mins sign)
    "(\.[a-z]{2,5})$": End with two to 5 character may use dot (.) in that

  1. Durgesh Tripathi

    Post:3

    Points:15
    what is email validation's regular expression in asp.net

    The RegularExpressionValidator control is used to ensure that an input value matches a specified pattern.
    It's used for email validate,numbervalidate, url validtate, special symbol validate, etc.

    Syntax for Regular Expression Validator

    <asp:TextBox ID="txtEmailID" runat="server"></asp:TextBox>
     <asp:RegularExpressionValidator ID="revEmailID" runat="server"
     ControlToValidate="txtEmailID"
     ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!