title: javascript email regex validation
body: <pre><code>var re = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/;
  var email = document.forms["checkout"]["email"].value;
  if (re.test(email.value)) {
      return true;
  } else {
      alert("Invalid email address");
      return false;
  }
  </code></pre>
  
  <p>I have tried quite a few email regex suggestions on this site but when the function is called it always throws the alert. Not even simple email address are coming back valid. What am I doing wrong?</p>