0

I have the below regex to match email address with atleast one @ and one .

[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]{2,4}

Am wondering can it be simplified further to match email address with atleast one @ and one .?

OTUser
  • 3,788
  • 19
  • 69
  • 127
  • Why don't you just use mailapi? – fge Jan 09 '15 at 11:43
  • http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/. – Aleksandr M Jan 09 '15 at 11:45
  • As @AleksandrM pointed out, it is generally considered a bad practice to validate email addresses via regexes. As to your question - no, it probably cannot be simplified any further. The truth is that you'll almost never be able to anticipate all the possible formats and combinations an email address might appear in. If the prior wasn't enough to discourage you, check out [this insane regex](http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html) for a near-perfect solution to your question. – Priidu Neemre Jan 09 '15 at 15:23

0 Answers0