A regular expression for email that tests exactly this One
A regular expression for email that tests exactly this:
· One or more word characters
· Exactly one at-sign
· One or more word characters
· Exactly one period
· Two or more characters that are a-z, A-Z, 0-9, period, or hyphen (One way to get \"two or more\" is to look for one such character and then look for one or more. Don\'t forget about character classes.)
Solution
var reg = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;
