Often, email validation code for web applications checks only for the position of @ and period characters, also assuming the @ character will be in the front of period. Did you know you can use a Java Script Regular Expressions method to check email addresses?
Description: A script that closely examines the content of a form box to ensure that the user entered a valid email address.
If not, the form submition is canceled, and the surfer prompted to re-enter a valid address.
A while ago I put up a Password Strength Checker using Java Script and Regular Expressions.
On that same note, you can also check the structure of an email address utilizing the same regular expression (regex) methodology.
The regular expression pattern is interpreted as follows.
method does not verify that the top-level domain name is a valid domain name listed at the IANA Root Zone Database, which would require a look-up operation.
Instead, the regular expression merely verifies that the top-level domain name consists of between two and twenty-four ASCII characters, with alphanumeric first and last characters and the remaining characters being either alphanumeric or a hyphen (-).
If the first character is a quotation mark, match a beginning quotation mark followed by at least one occurrence of any character, followed by an ending quotation mark.
The ending quotation mark must not be preceded by a backslash character (\).
If the character that follows @ is not an opening bracket, match one alphanumeric character with a value of A-Z, a-z, or 0-9, followed by zero or more occurrences of a word character or a hyphen, followed by zero or one alphanumeric character with a value of A-Z, a-z, or 0-9, followed by a period.