Paulund

Javascript Category

Regular Expression To Validate Email Address

The follow snippet is a function I use to validate email addresses. It is a very simple function which uses a regular expression pattern match to test if a email is of a correct format.

Valid Email Format

A valid format is email.address@domain.com/email@domain.com.

This takes in a parameter of the email address and then runs a pattern match against the regular expression. If it doesn’t find any matches then it will fail the validation and the function will return false, if the match returns true then the email will be of a correct format and the function will return true.
Read More →