title: Validation of Email in JavaScript
body: <p>I don't know why the regex patterns was not working ! I couldn't find any error ! But when i run this with wrong input it just skips the pattern test line and moves to the next page !</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Validation&lt;/title&gt;
      &lt;script&gt;
          function validate()
          {
              var email=document.myform.email.value;
              var pass=document.myform.pass.value;
              var phno=document.myform.phno.value;
              if(email!="" &amp;&amp; pass!="" &amp;&amp; phno!="")
              {
                  var emailcheck=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
                  var passcheck=/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}/;  
                  var phonecheck=/^[0-9]{10}+$/;
                  var result1=emailcheck.test(email);
                  var result2=passcheck.test(pass);
                  var result3=phonecheck.test(phno);
              }
              else
              {
                  alert("Validation failed");
                  return false;
              }
              if(result1 &amp;&amp; result2 &amp;&amp; result3)
              {
                  alert("Validation Successful");
                  //return true;
              }
              else
              {
                      alert("Validation Failed");
                      document.write("email should be as (xxx@gmail.com)"+"&lt;br/&gt;"+"password should be as (pass123)"+"&lt;br/&gt;"+"phone should be as (98659-57575)"+"&lt;br/&gt;");
                      return false;
              }
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form name="myform" action="number.php" onsubmit="return validate()"&gt;
      Email:&lt;input type="text" name="email"/&gt;&lt;br/&gt;
      Password:&lt;input type="text" name="pass"/&gt; &lt;br/&gt;
      Phone:&lt;input type="text" name="phno"/&gt; &lt;br/&gt;
      &lt;input type="submit" value="submit"/&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I expect the alert validation failed, if I give any input that mismatch the pattern.</p>