Today we use the built-in PHP filtersfrom link provided by me http://www.w3schools.com/php/php_form_url_email.asp you can see following:
$email = test_input($_POST["email"]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
Clear usage example of PHP filter for email as requested in question.Many things on the W3Schools site are still useful, but this is not one of them. It's literally several years out of date!, it is a contradiction.
Using a REGEX to validate an email address is the sort of thing we might have done a decade ago - nobody does something like that any more.Completely wrong statement! Gmail still use, for example, I guess, when somebody typed wrong symbol at registration, it suggests: (see image), how? REGEX! NOT PHP filter! Also you can google for live validation, and most of the time is REGEX.