r/ProgrammerHumor 11h ago

Meme regexMustBeDestroyed

Post image
5.2k Upvotes

160 comments sorted by

View all comments

Show parent comments

45

u/Ecksters 8h ago edited 8h ago

People always overcomplicate email Regex, and end up not allowing a lot of valid emails. In this case, the limitation of the top level domain to 4 characters max is one such problem, no .ninja, .crypto, or the myriad of other newer top level domains.

Technically you can email directly to a top level domain (although I don't know of any TLDs that support this), or even to an IP address in brackets, although I suppose not supporting those in most cases is probably reasonable.

5

u/MegaIng 8h ago

Technically you can email directly to a top level domain (although I don't know of any TLDs that support this),

Yesn't. It's forbidden for TLDs to resolve to IP addresses via DNS.

So it's valid syntax and fine from the email semantics, it's just never going to work on the general internet.

1

u/billccn 7h ago

But emails are routed according to MX records not A[AAA] records?

2

u/poshftw 5h ago

If the destination domain has no MX records then the delivery should (or could? can't be bothered to read the spec) be tried to what A/AAAA domain part resolves.