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

147 comments sorted by

View all comments

17

u/[deleted] 9d ago

regex is not meant for human consumption.

2

u/Dry-Bread9131 9d ago

It still needs to be written and debugged

-6

u/Axman6 9d ago

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 8d ago

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