Regular Expressions 101

Community Patterns

Custom HTML/JavaScript email input validation

0

Regular Expression
ECMAScript (JavaScript)

/
^(?:[\p{L}\p{M}\p{N}!#$%&'*+/=?^`{|}~-]|[\p{L}\p{M}\p{N}!#$%&'*+/=?^`{|}~-](?:[\p{L}\p{M}\p{N}!#$%&'*+/=?^`{|}~-]|\.(?!\.)){0,62}[\p{L}\p{M}\p{N}!#$%&'*+/=?^`{|}~-])@(?:[\p{L}\p{M}\p{N}]|[\p{L}\p{M}\p{N}][\p{L}\p{M}\p{N}_-]{0,61}[\p{L}\p{M}\p{N}])(?:\.(?:[\p{L}\p{M}\p{N}]|[\p{L}\p{M}\p{N}][\p{L}\p{M}\p{N}_-]{0,61}[\p{L}\p{M}\p{N}]))+\.?$
/
umg

Description

Only meant as an initial client-side filter to override the default input[type=email] validation done according to spec, which is much too simple.

Inputs passing this regex MUST get validated in a more fine-grained manner again when received on the server-side

Submitted by Neel Yadav - a year ago (Last modified a year ago)