Regular Expressions 101

Community Patterns

Emails regex

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(\w+[._%+-]*)+@(([a-zA-Z0--ÿ-]+-?)+\.)+[a-zA-Z]{2,}$
/
gm

Description

This regex will validate pretty much every mail that could exist. It allows aliases and tags in the mail, therefore the mail can contain one or more dots and/or "+" signs (Exemple: exemple.test.alias+tag+tag2). It also allows Internationalized Domain Names (IDNs) (Exemple: @café.com), subdomains (Exemple: domain.subdomain.com) and also "multiple" Top-Level Domain (Exemple: .com or .co.uk)

Submitted by Skyle - a year ago (Last modified a year ago)