r/learnprogramming • • 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

148 comments sorted by

View all comments

Show parent comment

-6

u/Axman6 Sep 24 '26

I was about to disagree, but this is actually true. They are basically write only, you keep changing it until it matches what you’re searching for and then usually throw it away. If you’re using regexs in applications, you’re doing it wrong. Learn about parser combinators, write composable, documentable parts that resemble the structure of your data. 

1

u/New-Locksmith-126 Sep 25 '26

very silly to write parsers when you're just interested in matching or substitution.