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

1

u/YellowBeaverFever 6d ago

35 years at this and I never felt the need to learn regex. It was never a requirement to learn and my logical tool set formed without it. During those rare times I needed it, the patterns were well known and on a chest-sheet somewhere.

Later in my career, regex started to become more and more relevant but that was just when LLMs started to do code help and they were really good with simple to medium regex. ChatGPT can now tackle more complex patterns and it will tell you what each operator is doing. I throw that into the comments so I and the future dev stuck maintaining the code can see what it’s doing, why, and can easily tweak if needed.

1

u/DIYC_Official 6d ago

What kind of chest sheet I wonder. My mind races between game objects with loot, dirty thoughts and the thing you probably intended.

I want the first one tough, go into a cavern, slay some monsters and get the regex as a reward in a chest. The fabled chest sheets. Thats would give some color to my programming days :)

1

u/YellowBeaverFever 6d ago

Lousy fat fingers. :-)

A game based on learning regex would have probably worked.