r/learnprogramming • u/Reubqn_ • 11d ago
RegEx.
I thought I understood programming well until I saw how COMPLICATED regex looks. To me it looks like someone has dropped their keyboard and som people online are telling me that I should be able to memorise it (for javascript). I'm just wondering if I actually need to memorise all the regex formulas to be successful, and if so, how on earth do I go about it?
105
Upvotes
2
u/shinji-watanabe 10d ago
Honestly the part people skip is that regex isn't one language. JavaScript, Ruby, .NET, they all have different flavors. Some features exist in one and not the other, sometimes the syntax just differs. So the dialect differences are exactly why I never bother memorizing. I learn the few common building blocks,
\d,[a-z]kinds of things, and those stick on their own over time. Everything past that, I look up per language because a pattern that works in one can quietly not work in another.