DEV Community

Discussion on: How to validate an email address in JavaScript

Collapse
 
camainc profile image
Charles Cherry • Edited

Your regex doesn't allow for many valid email addresses. Basically just about anything before the "@" symbol (the local part) is allowed. A lot of gmail addresses have the format

some.name@gmail.com

"The local part can be up to 64 characters in length and consist of any combination of alphabetic characters, digits, or any of the following special characters:

! # $ % & ‘ * + – / = ? ^ _ ` . { | } ~

NOTE: The period character (“.”) is valid for the local part subject to the following restrictions:

  • it is not the first or last character
  • two or more consecutive periods"

mailboxvalidator.com/resources/art...