Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-01-28 14:59
Flavor·PCRE (Legacy)

/
^(?:[\w\d\.-_])+@(?=.{4,64}$)(?:[\w\d]+[-]?[\w\d]+\.|[\w\d]\.)+(?:\w{2,})$
/
Open regex in editor

Description

Usernames with dots, dashes and underscores. Hostnames limited to 64 chars, dash disallowed at first char of domain segment, only one consecutive dash or dot, one-char domains possible, multi-subdomains, long TLDs.

Submitted by Forseti