Regular Expressions 101

Community Patterns

Community Library Entry

4

Regular Expression
ECMAScript (JavaScript)

/
^((\w[^\W]+)[\.\-]?){1,}\@(([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,}))$
/
gm

Description

VALIDATE ALL WOLRD MAIL RULES

  1. Very simple expression
  2. Less than 140 caracters.
  3. Validate on SonarQube typescript, javascript, angular rules

EXAMPLES

JOAO!DA.SILVA@CNN,COM (INVALID) joao@microsoft.com mauricio.teste@site.ba.gov.br santana.teste@sistema-ba.ba.gov.br teste.teste.teste.igor.caza@google.com teste.teste.teste.igor.caza@globo.com.br ayslan-johnson@teste.com.br joao@123.com ayslanjohnson@google.com teste.teste.teste.igor.caza@globo (INVALID) SILVA.teste@SITE-ba.ba.gov.br. (INVALID)

Submitted by Ayslan Johnson (ayslanjohnson@gmail.com) - 7 years ago