title: rails - REGEX for email validation
body: <p>I'm looking for a regex to validate an email to learn if it's valid or not.. I have the following:</p>
  
  <pre><code>def is_a_valid_email?(email)
      email_regex = %r{
        ^ # Start of string
        [0-9a-z] # First character
        [0-9a-z.+]+ # Middle characters
        [0-9a-z] # Last character
        @ # Separating @ character
        [0-9a-z] # Domain name begin
        [0-9a-z.-]+ # Domain name middle
        [0-9a-z] # Domain name end
        $ # End of string
      }xi # Case insensitive
  
      (email =~ email_regex)
  end
  </code></pre>
  
  <p>Problem with the above is <code>XXX_XXX@Xxx.com</code> does not return as valid when it should be. Any thoughts or suggestions for a better regex?</p>
  
  <p>Thanks</p>