Thank you. I need to improve the explanations as well. (Will fix those :) )
at some point, I really felt embarrassed to share this.
It's been sitting in my Github for a while and I finally decided to share and see what everyone else thinks about it.
Your feedback has been of great help :D (there is also a beginners tutorial article in the making)
Basically, since there are so many rules and edge cases about emails, creating a Regex to solve that problem is not a productive approach since if new edge cases are created or found, maintenance instantly becomes hell and the pattern most likely has to be recreated from scratch.
Fortunately, people have already poured tons of hours into solving that problem for us and we can build on their shoulders.
Another example where regex looks like an appropriate tool but isn't is with parsing HTML. It sprung a famous Stack overflow question answer.
Thank you. I need to improve the explanations as well. (Will fix those :) )
at some point, I really felt embarrassed to share this.
It's been sitting in my Github for a while and I finally decided to share and see what everyone else thinks about it.
Your feedback has been of great help :D (there is also a beginners tutorial article in the making)
If your repo is public, I'd be glad to help with a PR or two! 😊
Here you go 😊:
github.com/geongeorge/i-hate-regex
The code is not the most elegant (I have to warn you)
Huh. I always do complex stuff like this with regex, in frontend as well as in backend.
What would be your tool of choice?
Depends on the language, in PHP for example, there's this library: github.com/egulias/EmailValidator
Basically, since there are so many rules and edge cases about emails, creating a Regex to solve that problem is not a productive approach since if new edge cases are created or found, maintenance instantly becomes hell and the pattern most likely has to be recreated from scratch.
Fortunately, people have already poured tons of hours into solving that problem for us and we can build on their shoulders.
Another example where regex looks like an appropriate tool but isn't is with parsing HTML. It sprung a famous Stack overflow question answer.
I just launched iHateRegex on Producthunt 😺
👉👉
producthunt.com/posts/i-hate-regex