5 ms·
Email validation should just be sending a confirmation email. Otherwise you end up with a super large regex and having to update it every time there is a new TL
by hmate9 5y ago
Email validation should just be sending a confirmation email. Otherwise you end up with a super large regex and having to update it every time there is a new TLD.
- doubled112 5y agoI'd imagine the regex just doesn't get updated, leading to this exact problem.
- gtirloni 5y agoNo sane person keeps a list of all TLDs in a regex. It's huge and they keep changing.
- hunter2_ 5y agoThe regex in OP's screenshot just says that it needs to end with between 2 and 4 characters after the last dot.
- ceejayoz 5y agoYou could concievably regularly grab the list from http://data.iana.org/TLD/tlds-alpha-by-domain.txt http://data.iana.org/TLD/tlds-alpha-by-domain.txt.
- itronitron 5y agoi wonder why they haven't yet added '.corn' as a TLD
- chockchocschoir 5y agoIndeed, that would truly be some insane regex and unfeasible to maintain. Here is the official list of registered TLDs from IANA: https://data.iana.org/TLD/tlds-alpha-by-domain.txt https://data.iana.org/TLD/tlds-alpha-by-domain.txt > Last Updated Wed Mar 16 07:07:01 2022 UTC Have fun keeping up-to-date with it.
- rovr138 5y agoIf you wanted, you could parse the list and build dynamically the tld portion of the regex. But also, you can get the tld and match it against the list, then send an email.
- tjpnz 5y agoThe point is that you shouldn't ever be in that position to begin with. Maybe your regex does some simple sanity checks but you shouldn't ever be baking assumptions about the TLD into it. The confirmation email should do the heavy lifting.
- chockchocschoir 5y agoThe only real regex that would be relatively future-proof is one that checks that there is a "@" and a "." somewhere in the address, and that the "@" comes before the last ".". Anything else is a fool's errand. Actually, even trying to use regex to see if a email is valid is a fool's errand, but if you have to, the rule above is the only thing you could do. You really need to send a email to address and ask the user to input something from the email in order to actually validate it.
- yakak 5y agoICANNlandgrab@sony
- chockchocschoir 5y agoGreat work, I put three basic rules in my comment and you failed two of them :)
- Avamander 5y agoTheoretically a MX record on a TLD is valid, but I doubt many try to use that.
- Brian_K_White 5y agoI noticed that .nft was missing and spent about 30 minutes trying to google how one goes about registering for one and gave up. Someone else will make that killing.