Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^([a-z][a-z0-9]{1,13}[_.\-]?[a-z0-9]{1,13})@(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|([a-z0-9]{1,10}[\-]?[a-z0-9]{1,10}[.]?[a-z0-9-]{1,10}[.]{1}[a-z]{2,4}))$
/
gm

Description

Safe EMail validation protected against ReDos attack.

  • Exclude all non conventionnal special char like #{%... only accept . - and _. .
  • EMail can't start with number or specials chars.
  • Domain accept only one subdomain and ip are available
  • 63 Maximum characters accepted
  • Check for valid IP
Submitted by J.Delauney - 2 years ago