2 ms·
Yeah, you'd need a longer field for maximum correctness for sure. Reminds me of the RFC 822 regex for validating an email address [1] (clocking in at a full pag
by brandur 5y ago
Yeah, you'd need a longer field for maximum correctness for sure. Reminds me of the RFC 822 regex for validating an email address [1] (clocking in at a full page, although now there are simpler ones you can use).
I tend to think that there is a point where you trade off some correctness for pragmatism. It is true that you could have a user with a 250 character email address, but in a lot of years I've never really seen a legitimate one, and the likelihood is that if you do see one then it's someone doing something weird as opposed to a legitimate customer.
Email is actually one that you might want to just leave as `TEXT` and make sure you're validating with a package, which is something you might want to do anyway. However, I still think it serves as a useful example because most people have a good feel for about how long an email address is.
---
[1] http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html