me: i need to validate some email addresses, so i am going to write a quick regex.
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft
At your point it might be easier to just search haveibeenpwned for the address -
@nixCraft If we ever get a Ten Commandments for programming, one of them should be:
"Thou shalt not write thy own email regex."
@mahryekuh @nixCraft I thought it was reserved as a karmic punishment,
you shall be cast into the darkness with the regex nought to return until the email be atuned
type stuff
Or was that a nightmare. . .? -
R relay@relay.an.exchange shared this topic
-
@nixCraft RegEx, almost always the wrong choice
@zephyrxero @nixCraft
"I should have used logic, but this keeps the complexity rating down." -
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft Unwanted Summonings in Cyberspace
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft
I gave up when I realised emojis were valid characters in email addresses. -
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft The plural of "regex" is "regrets"

-
@nixCraft regex might be hard, the email addresses RFC is "wild", cf.
The answer that quiz gives on question 7 is not how I read the RFC. I looked at both RFC 821 and RFC 5321, neither permits spaces in an unqouted local-part.
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuckDid you find the needle in the haystack yet? /s
-
The answer that quiz gives on question 7 is not how I read the RFC. I looked at both RFC 821 and RFC 5321, neither permits spaces in an unqouted local-part.
-
-
-
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft Either you use something simple like
.*@.*\..*(at least an at-sign and a dot after it) and send an e-mail with an link or you will summon a debate war on if the complete e-mail standards should be followed or not.And, if you choose to follow the standards, I have to warn you (and I guess some people had warned you already) that most e-mail servers do not follow the standard (like Cloudflare).
On the other hand, I just sent a message from
"example+';DROP/**/TABLE/**/users;#"@gmail.comtoexample@some-domain-of-mineand it arrived. I hope you never need to deal with addresses like those. -
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft My experience tells me that if you have a problem and you solve it with regular expressions, you have two problems.
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck -
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuckAt least the ancient demon is bound to serve you, and not eat you until it provides you with a perfect email parsing library, right?
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft https://regex101.com/ is your friend, your very very good friend
-
@nixCraft Either you use something simple like
.*@.*\..*(at least an at-sign and a dot after it) and send an e-mail with an link or you will summon a debate war on if the complete e-mail standards should be followed or not.And, if you choose to follow the standards, I have to warn you (and I guess some people had warned you already) that most e-mail servers do not follow the standard (like Cloudflare).
On the other hand, I just sent a message from
"example+';DROP/**/TABLE/**/users;#"@gmail.comtoexample@some-domain-of-mineand it arrived. I hope you never need to deal with addresses like those.@qgustavor@urusai.social @nixCraft@mastodon.social you have successfully summoned a debate war by forgetting that user@localhost is a valid email, so is user@::1, and any other locally resolved name and ipv6 address. Just containing a @ is more than enough if you already try to send an email to it.

Seriously though, enforcing a dot in the domain is probably reasonable for most publicly accessible email servers. -
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft Can the daemon validate things for you?
-
me: i need to validate some email addresses, so i am going to write a quick regex. how hard can it be?
*4 hours later*
me. i now have 2 problems and one of them is that I've accidentally summoned an ancient daemon. wht the actual fuck@nixCraft now toss moving between BSD/macOS and GNU into the mix.