Email validation rules, please make them public knowledge

During signup, the lock form does some email validation:


Other parts of our system also validate emails and we want to provide a consistent experience across our whole app regarding email rules.

What are the exact rules Auth0 uses for this field? Or the regex used?

Hey there @jesse2!

Not sure about that but let me do the research and get back to you soon!

Thanks @konrad.sopala
Did you find anything yet?

1 Like

Hey there @jesse2!

I was told by our engineering team that we do have no doc on the rules we use in Lock for validating those fields. The only source of knowledge for that is to inspect Lock source code.

1 Like

Thanks for the suggestion. I believe I’ve found it here:

const regExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
1 Like

Thanks a lot for sharing that with the rest of community!

This topic now contains incorrect information: Email validation rules, please make them public knowledge

Auth0 used to use the regex shown, but they have since switched to using isEmail from the npmjs validator package.

Unfortunately the topic was closed so I can no longer reply and correct the misinformation. Please update the topic with correct info.


Thank you @jr.willett! I have moved your post to this topic so that others will know that isEmail from the validator package is what Auth0 uses now.