The regular expression is really not suitable for determining the validity of the syntax of the email address and the FILTER_VALIDATE_EMAIL parameter for the filter_var function filter_var also very unreliable. I am using the EmailAddressValidator Class to check the syntax of an email address.
I have compiled some examples of incorrect results returned by filter_var (PHP Version 5.3.2-1ubuntu4.2). There are probably more. Some of them are admittedly a bit extreme, but still worth noting:
RFC 1035 2.3.1. Preferred Name Syntax
http://tools.ietf.org/search/rfc1035
Summarizes as: a domain consists of labels separated by dot separators (not necessarily true for local domains, though).
echo filter_var(' name@example ', FILTER_VALIDATE_EMAIL);
RFC 1035 2.3.1. Preferred Name Syntax
Labels must comply with ARPANET hostname rules. They must begin with a letter and a letter or numbers and have only letters, numbers and hyphens as internal characters.
echo filter_var(' name@1example.com ', FILTER_VALIDATE_EMAIL);
RFC 2822 3.2.5. Quoted lines
http://tools.ietf.org/html/rfc2822#section-3.2.5
This is valid (although it is rejected by many mail servers):
echo filter_var('name"quoted" string@example ', FILTER_VALIDATE_EMAIL);
RFC 5321 4.5.3.1.1. Local part
http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
The maximum total length of a username or other local part is 64 octets.
Test with 70 characters:
echo filter_var('Abcdefg hijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghij@ example.com', FILTER_VALIDATE_EMAIL);
RFC 5321 4.5.3.1.2. Domain
http://tools.ietf.org/html/rfc5321#section-4.5.3.1.2
The maximum total length of a name or domain number is 255 octets.
Testing with 260 characters:
echo filter_var(' name@AbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghi jAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghijAbcdefghij.com', FILTER_VALIDATE_EMAIL);
See Confirm Email Address Using PHP, The Right Way For More Information.