Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I thought new TLD being worked on didn't need to have dots in them.

Why not just check for x@x?



To use just the TLD, the domain will need to be fully qualified with a trailing dot, "x@tld.". Otherwise, the domain can get confused with just the hostname in the local domain (tld.example.com). Just the hostname is a valid email address but wouldn't need to be accepted by most signup forms.

My guess is that nobody will use just the TLD because of the confusion. And because a lot of software does not support fully qualified names.


As far as I know the new tlds will still have a dot between tld and actual domain (I could be wrong though) but it's just been pointed out that IPv6 emails addresses could fail on my regex. The reason I don't currently use x@y is just to have a better shot at catching typos without being too restrictive.


There is no requirement for any other level in a domain, except for the TLD.


That's exactly what you should do.

^(.+)@(.+)$

max length is 254 according to the RFC I believe, so you can check for that too.


The bonus with that regex is that it kind of looks like a dead clown.


Bingo. I'm sure there are some HNers with arpanet emails who would appreciate this; it's not just about ipv6!


IIRC, last I checked max length was 320.


I thought this as well, until looking for info one day and stumbling onto this:

http://stackoverflow.com/questions/386294/what-is-the-maximu...

Turns out the 320 value was actually incorrect, its 256 but the mailbox is wrapped in square brackets, so 256 - 2 = 254.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: