Regular Expressions 101

Community Patterns

Email regex validation


Regular Expression
ECMAScript (JavaScript)



RegEx email


Just playing with Reg Ex. This to validate emails in following ways

  • The email couldn't start or finish with a dot
  • The email shouldn't contain spaces into the string
  • The email shouldn't contain special chars (<:, *,ecc)
  • The email could contain dots in the middle of mail address before the @
  • The email could contain a double doman ( '' or similar rarity)


There was created 3 groups into this validations that could be used for custom purposes or replacements

  • First group takes the first string with the name of email $1 => (mailname)
  • Second group takes the @ plus the domain: $2 => (@domain)
  • Third group takes the last part after the domain : $3 => (.com)
Submitted by - 5 years ago (Last modified a year ago)