Last Updated: February 25, 2016
·
752
· ready4god2513

Simple Email Regex

I have always been against using regular expressions for email validation. The spec is just too complex. So many forms validate me+you@gmail.com as an error. Which is incorrect. So in the spirit of learning regex, I decided to try my hand. This pattern seems to match quite well for everything I have thrown at it. It is loose enough to allow flexibility, but strict enough to not let the blatant errors get by.

^((\S+)@(.+)(\.)(\S+))$ # Ruby only

Thoughts on it?