What is the regex of email:rfc.dns validation rule?
Does anyone know the regex equivalent for the email:rfc.dns validation rule? I need it for the front end (JavaScript) but couldn't exactly match it so right now my frontend allows certain email addresses that my backend won't and it's bad for UX since it shows these email addresses as valid
Edit: It uses this package: https://github.com/egulias/EmailValidator , is it even possible to "convert" this package validation of emails into 1 regex? (when using the rfc and dns rules)
DNS Validation checks if the domain name in the provided email address is accepting emails (MX records etc.). You could technically do that from the front-end using some APIs, but that is totally not necessary. You should not do exact validation in the frontend as well. Just let the backend handle the hard work. (It is not regex based)
RFC Validation is very complex and has different varieties. This: https://gist.github.com/badsyntax/719800 , and much more complex. Again, I would just stick with basic validation in the front-end.
For example: You could do compromised password validation in the frontend, but you normally wouldn't.
@Niush Thanks, I ended up using a simple regex for just a basic email structure, as I'm sending email to verify the address and there is no point messing with it too much then, it only complicates the things in my opinion
Dose it really solve the problem? Because I faced the similar issue my users were misspelling word gmail.com to gmsil.com. but It still allowing it because gmsil.com is valid domain name.
But if I try [email protected] any random string as email front and gmsil.comstill it is allowing it.