Email validation w3schools

According to W3Schools, an email address is considered valid if it meets the following criteria:

  1. It starts with a letter (a-z or A-Z) or a number (0-9).
  2. It is followed by a period (.), hyphen (-), or underscore (_).
  3. It can contain letters (a-z or A-Z), numbers (0-9), periods (.), hyphens (-), underscores (_), and the at symbol (@).
  4. It must contain at least one character after the at symbol (@).
  5. The part before the at symbol (@) is called the local part, and it can contain up to 64 characters.
  6. The part after the at symbol (@) is called the domain, and it can contain up to 255 characters.
  7. The domain must contain at least one period (.) and cannot start or end with a period (.) or hyphen (-).

Here are some examples of valid email addresses:

And here are some examples of invalid email addresses:

W3Schools also provides a regular expression that can be used to validate email addresses:

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

This regular expression matches most common email address formats, but it's not foolproof and may not match all valid email addresses.