Email is easy
Validating an email address is one of those first string parsing exercises you do when learning about regular expressions.
Just check that there’s some valid text before the @ symbol: ^\w+
…then some more text: ^\w+@\w+
…followed by a period and another piece of text ^\w+@\w+\.\w+$
Cool, what about domains like co.uk?
No problem: ^\w+@\w+(\.\w+)+$
Oops, some people have a period in the first part too firstname.lastname.
// This one should cover everything!
^[\w.]+@\w+(\.\w+)+$
Aaaand, we’re done right?
You wish… https://e-mail.wtf
At some point, I just started to go against my intuition and chose the opposite of my best judgment and managed to rack up a decent score.
Most of those are clearly extreme examples and probably not very likely to be encountered in the wild, but it goes to show that even the simplest things can hide a huge layer of complexity.
Here are the top 5 contenders for my next perfectly valid email address:
-
ņ̷̧̡̰̥̋̌̀͂̆̿̇o̶̖̲̱̩̘̰͎̯̎w̷̨̧̖͖̟͆͛ạ̵͕̀͛̔̒y̸̨̆̀̌̍͋̐̉̀̏͠@yeah.haha
-
”:(){␣:|:&␣};:“@what.com
-
🦀@🦀
-
”@”@[@]
-
”’()’”(”””)@ok.bro