^ means, what follows should be at the beginning of the string provided
[A-Z0-9._%-]+ means to find 1 or more occurrences of letters, numbers, ., _, %, or -
@ means to find the @ symbol after you find one or more of the occurrences of the line above.
[A-Z0-9.-]+ means to find 1 or more occurrences of letters, numbers, ., or - following the @ symbol
\. means to find a . after the line above
[A-Z]{2,4}$ lastly, find 2 to 4 characters that are after the . and are at the end of the string
So you can deduce by the above explanation, that you won’t get a match for “” because it fails to find 1 or more characters at the beginning of a string that are letters, numbers, ., _, %, or -. Plus it fails to have the @ in after find those said beginning letters and it fails to have the required . before the suffix of the domain (which also must exist as the end of the string)
// Clean Email
if (!empty($email) && !preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i",$email)) { // verify the email is not empty, check if it passes the regex
header( "Location: $errorurl" );
exit ;
}