How to validate email addresses in PHP
This regex will match email adresses. However, it’s not bulletproof. Emails such as
____@--... would still pass validation.
If you are using PHP, you can also use
filter_var() and save yourself some headaches. As illustrated here, it correctly validates most addresses.
filter_var('firstname.lastname@example.org', FILTER_VALIDATE_EMAIL); //Returns true if email is valid, false otherwise