Email validation does not work correctly #34602
-
Hi all. When I use form validation for an email type field, this validation does not work correctly in my opinion. Example: If I write: name @ domain, it validates it as being written correctly, when that is not a valid email since it is missing, for example .com or .es or .net ... Is it possible to quickly correct this part? I think it is important to give this solution. Greetings |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Email validation uses the browsers built-in validation regex RFC 5322/5952 which allows for every single possible valid email address. There are some TLDs or valid email addresses that you might know exist. You could include your own Regex though - here's one that works with (approx) 99.99% of addresses: If you want to validate that the TLD is valid, I made a simple HTML5 pattern a few years ago (using no JavaScript!) which validates against a list of valid TLDs which you might find helpful. See code and demo here: https://github.com/coliff/html5-email-regex |
Beta Was this translation helpful? Give feedback.
-
Email Validation is far different than one imagines it to be. Especially after the introduction of the Internationalized Domain Names and by extension Internationalized Email Addresses, it has become challenging to do it in the most appropriate manner while achieving the requisites of Validation. At the risk of getting flagged as spam, I would still post a link to the article I wrote a couple of months back. Hope it churns the requisite discussion among the community. |
Beta Was this translation helpful? Give feedback.
Email validation uses the browsers built-in validation regex RFC 5322/5952 which allows for every single possible valid email address. There are some TLDs or valid email addresses that you might know exist.
You could include your own Regex though - here's one that works with (approx) 99.99% of addresses:
https://www.emailregex.com/
If you want to validate that the TLD is valid, I made a simple HTML5 pattern a few years ago (using no JavaScript!) which validates against a list of valid TLDs which you might find helpful. See code and demo here: https://github.com/coliff/html5-email-regex