Regular Expressions 101

Community Patterns

Simple email verification regex

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?=[a-z][a-z0-9@._-]{5,40}$)[a-z0-9._-]{1,20}@(?:(?=[a-z0-9-]{1,15}\.)[a-z0-9]+(?:-[a-z0-9]+)*\.){1,2}[a-z]{2,6}$
/
gm

Description

  • Regular Expression

    ^(?=[a-z][a-z0-9@._-]{5,40}$)[a-z0-9._-]{1,20}@(?:(?=[a-z0-9-]{1,15}\.)[a-z0-9]+(?:-[a-z0-9]+)*\.){1,2}[a-z]{2,6}$
    
  • By default, the app converts all the email value to lower case before validation.

  • Please use regex101.com: email to analyse and validate the regex.

  • The error message for an invalid format, (to be translatable in Ar is supported).

    Please insert a valid email address.

Example

Submitted by Sowed Castelli - 3 years ago