The Internet task engineering group (IETF) document, written by John Klensin, RFC 3696 "Application Technology check and name conversion" provides multiple real and valid EMAIL addresses, but unfortunately these addresses were rejected by most PHP validators, addresses Abc @ def@example.com, customer/department = shipping@example.com and! Def! Xyz % abc@example.com is valid, and below is a very popular regular expression given in the relevant literature, but it rejects all the e-mail addresses given above:
^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$ |
This regular expression can only contain underscores (_), hyphens (-), numbers, and uppercase/lowercase letters. Even if the uppercase and lowercase letters are converted before this, the system rejects the slash (/), equal sign (=), and exclamation point (!) characters that contain the slash (!) And percent sign (%. This expression also requires that the highest level of the domain component must contain at least two or three characters, so it also rejects valid fields, such as. museum.
Another popular regular expression is:
^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$ |
This regular expression also rejects the valid example address given in the previous paragraph. it elegantly solves the case of upper-case letters and does not return an error when the highest-level domain name has only two or three characters, however, it allows invalid domain names, such as example..com.
Listing 1 shows (