MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/xly172/refactoring_just_working_solution/ipm6vml
r/ProgrammerHumor • u/VitaminnCPP • Sep 23 '22
355 comments sorted by
View all comments
Show parent comments
80
task of simplifying
I realized I could solve this one problem with a REGEX, and now I have two problems…
26 u/akatherder Sep 23 '22 I need a regex to validate email address.(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/= ?^_`{|}~-]+)*|" (?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b \x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9] (?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\ [(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5] |2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\ x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c \x0e-\x7f])+)\])Well that was intuitive. 18 u/git0ffmylawnm8 Sep 23 '22 ... aight imma head out chief this ain't it 11 u/[deleted] Sep 23 '22 You do know that the only sure-fire way of validating an email address is to try sending mail to it, right? 3 u/OrganicBid Sep 24 '22 I usually point people to https://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643 if they have to make a local validator. 2 u/VitaminnCPP Oct 11 '22 I need regex to validate regex that validates email. 36 u/ThePyroEagle Sep 23 '22 Using regex is rarely a simplification. 26 u/omgFWTbear Sep 23 '22 https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/amp/This is a reference at least 25 years old. 9 u/[deleted] Sep 23 '22 I use this and think it is better than regex buddy.https://regex101.com/ 2 u/TheMacMini09 Sep 23 '22 Don’t forget that article was written in 2008. I would imagine there’s a lot of better tools than RegexBuddy that have been created in the last 14 years. 1 u/[deleted] Sep 23 '22 Regex buddy is still under development and is quite robust. I own it 1 u/SpaceShrimp Sep 23 '22 And it rarely cover all edge cases, and even less after someone some tries to modify it to add some functionality, and almost succeeds.
26
I need a regex to validate email address.
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/= ?^_`{|}~-]+)*|" (?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b \x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9] (?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\ [(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5] |2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\ x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c \x0e-\x7f])+)\])
Well that was intuitive.
18 u/git0ffmylawnm8 Sep 23 '22 ... aight imma head out chief this ain't it 11 u/[deleted] Sep 23 '22 You do know that the only sure-fire way of validating an email address is to try sending mail to it, right? 3 u/OrganicBid Sep 24 '22 I usually point people to https://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643 if they have to make a local validator. 2 u/VitaminnCPP Oct 11 '22 I need regex to validate regex that validates email.
18
... aight imma head out chief this ain't it
11
You do know that the only sure-fire way of validating an email address is to try sending mail to it, right?
3 u/OrganicBid Sep 24 '22 I usually point people to https://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643 if they have to make a local validator.
3
I usually point people to https://medium.com/hackernoon/the-100-correct-way-to-validate-email-addresses-7c4818f24643 if they have to make a local validator.
2
I need regex to validate regex that validates email.
36
Using regex is rarely a simplification.
26 u/omgFWTbear Sep 23 '22 https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/amp/This is a reference at least 25 years old. 9 u/[deleted] Sep 23 '22 I use this and think it is better than regex buddy.https://regex101.com/ 2 u/TheMacMini09 Sep 23 '22 Don’t forget that article was written in 2008. I would imagine there’s a lot of better tools than RegexBuddy that have been created in the last 14 years. 1 u/[deleted] Sep 23 '22 Regex buddy is still under development and is quite robust. I own it 1 u/SpaceShrimp Sep 23 '22 And it rarely cover all edge cases, and even less after someone some tries to modify it to add some functionality, and almost succeeds.
https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/amp/
This is a reference at least 25 years old.
9 u/[deleted] Sep 23 '22 I use this and think it is better than regex buddy.https://regex101.com/ 2 u/TheMacMini09 Sep 23 '22 Don’t forget that article was written in 2008. I would imagine there’s a lot of better tools than RegexBuddy that have been created in the last 14 years. 1 u/[deleted] Sep 23 '22 Regex buddy is still under development and is quite robust. I own it
9
I use this and think it is better than regex buddy.
https://regex101.com/
2 u/TheMacMini09 Sep 23 '22 Don’t forget that article was written in 2008. I would imagine there’s a lot of better tools than RegexBuddy that have been created in the last 14 years. 1 u/[deleted] Sep 23 '22 Regex buddy is still under development and is quite robust. I own it
Don’t forget that article was written in 2008. I would imagine there’s a lot of better tools than RegexBuddy that have been created in the last 14 years.
1 u/[deleted] Sep 23 '22 Regex buddy is still under development and is quite robust. I own it
1
Regex buddy is still under development and is quite robust. I own it
And it rarely cover all edge cases, and even less after someone some tries to modify it to add some functionality, and almost succeeds.
80
u/omgFWTbear Sep 23 '22
I realized I could solve this one problem with a REGEX, and now I have two problems…