title: Using regex for simple email validation
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses">What is the best regular expression for validating email addresses?</a><br>
    <a href="https://stackoverflow.com/questions/161342/is-there-a-php-library-for-email-address-validation">Is there a php library for email address validation?</a>  </p>
  </blockquote>
  
  
  
  <p>On my register form a user will add his email and then get an email to verify his account. However I want to have a simple email validation and I would like to know if the following is appropriate.</p>
  
  <pre><code>&lt;?php
  $email = "someone@example.com";
  
  if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
  
    echo "Valid email address.";
  }
  
  else {
  
    echo "Invalid email address.";
  }
  ?&gt;
  </code></pre>