Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
function email()
{
  if (document.getElementById("<%=txtEmail.ClientID%>").value=="")
      {
                 alert("Please enter your Email ID");
                 document.getElementById("<%=txtEmail.ClientID%>").focus();
                 return false;
      }

  
    var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
     var emailid=document.getElementById("<%=txtEmail.ClientID%>").value;
     var matchArray = emailid.match(emailPat);
     if (matchArray == null)
    {
               alert("Your email address seems incorrect. Please try again.");
               document.getElementById("<%=txtEmail.ClientID%>").focus();
               return false;
    }
    }
Posted

1 solution

I would go for a regular expression like that :

[02-9]\d{7,9}

which will match any string beginning with a digit except 1, followed by 7 to 9 digits.
 
Share this answer
 
v2
Comments
nityasri 22-Mar-13 20:55pm    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900