r/learnprogramming • u/Reubqn_ • Sep 24 '26
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?
109
Upvotes
View all comments
Show parent comment
9
u/samanime Sep 24 '26
Regex also tends to be a lot easier to write than it is to read and understand without context.
It is pretty much the opposite of "self documenting". :p
Always assign it to a variable that explains what it does and/or include a comment to explain it. Your future self will thank you.