Skip to content

Instantly share code, notes, and snippets.

@rswift
Last active September 13, 2023 08:54
Show Gist options
  • Select an option

  • Save rswift/d95b51d61740383bbcd6f339f554a29b to your computer and use it in GitHub Desktop.

Select an option

Save rswift/d95b51d61740383bbcd6f339f554a29b to your computer and use it in GitHub Desktop.
an imperfect but simple email regex for CloudFormation AllowedPattern
^\b([a-zA-Z0-9][\.\-_a-zA-Z0-9]+)\b@\b([a-zA-Z0-9][\-_a-zA-Z0-9]+)\b\.{1}\b(.*)\b$
#
# not massively well tested, or spectacular, but it works for generally agreeable, mostly typical [email protected] style addresses
#
#
# passing
#
[email protected]
[email protected]
[email protected]
a-user@a_domain.co.uk
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
user9801@domain_uk.com
[email protected]_uk.com
[email protected]_uk.com
#
# don't pass
#
@domain
@domain.com
user@
🖖@domain.co.uk
user@domain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment