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})@((([0-9]{1,3})([.]{1})([0-9]{1,3})([.]{1})([0-9]{1,3})([.]{1})([0-9]{1,3}))|([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. It 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

Submitted by J.Delauney - 2 years ago