Regular Expressions 101

Community Patterns

Email matching with a grain of salt

1

Regular Expression
PCRE (PHP <7.3)

/
^ (?<username> (?:[a-zA-Z0-9\{\}_+][a-zA-Z0-9+\.\\\/_\-\{\}~=]+[a-zA-Z0-9\{\}_+]) | (?:\"(?:[a-zA-Z0-9\\\/\[\]\{\}\(\)\.,;~#_=@&<>+\- ] | \\\")+\") | (?:[a-zA-Z]+) ) @ (?<domain> (?:[a-zA-Z0-9]+\.?)+\.(?:[a-zA-Z0-9]+) ) $
/
gmx

Description

Inspired by Micheal Musson entry Wich was hard to use in regex flavours that don't support recursion (C# engine doesn't) i've build my own simpler version wich matches what i would accept as validation entry

Submitted by Luigi Trabacchin - 7 years ago