Email validation for Auth0

Based on the answer here: Email regex verification

I used the regex from the site the answer linked: https://emailregex.com/

That regex follows the RFC standard as close as possible. When I try to create email addresses using either the API or Auth0 user interface I run into problems with some email addresses. a@b.c is a valid email address according to the standard, and the regex. Auth0 rejects this email address.

What is the email address criteria that Auth0 uses? I need to create a regex so my app will not allow ‘invalid’ email addresses through. It seems like Auth0 has it’s own standard, and I don’t know what that is.

Thank you,
Kevin

The fully RFC 822 compliant regex is inefficient and obscure for validate email address because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is RFC 5322. RFC 5322 leads to a regex that can be understood if studied for a few minutes and is efficient enough for actual use.

If you use HTML5, use this code:

<input type="email" name="email" required placeholder="Enter a valid email address">

1 Like

Thanks for the input @rwandamc!