Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does this e-mail-regex exclude valid addresses?

I tried to create a regular expression which catches all RFC-valid addresses but it's ok if some false-positives come through (though hopefully not so many). This is waht I came up so far:

/^\b\S+@\S+\.[^\s@]{2,}\b$/

Is there any RFC-valid address which doesn't match against this expression or do you have any suggestions to improve it? I don't mind the false positives but I would be glad if you show me a few, too.

like image 711
neo Avatar asked Sep 17 '26 01:09

neo


1 Answers

Check out this post:

Using a regular expression to validate an email address

There is also this one:

http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html

Nothing like a 6000+ character regex!

like image 123
Scott Avatar answered Sep 19 '26 05:09

Scott