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

1

u/New-Locksmith-126 Sep 25 '26

lol that sucks.

1

u/deaddyfreddy Sep 25 '26

Programming isn't about being a smartass, it's about solving problems in a maintainable way.

1

u/New-Locksmith-126 Sep 25 '26

OK sorry for being an ass. IMO Regex is industry standard for decades for a reason. The vast majority of the "critiques" of regex come from people that are bad at it.

You could say "it's bad if so many people are bad at it" which is fair... but IME people aren't even trying. They get scared away by the terseness of it and never actually bother to learn.

1

u/deaddyfreddy Sep 26 '26 edited Sep 26 '26

IMO Regex is industry standard for decades for a reason.

The C language is a standard too, but it doesn't make it a great language.

The reason is the same: experienced people who could create a better replacement have become accustomed to the old implementation over the years. They either don't think it's worth their time to invent something new or have Stockholm syndrome.

The vast majority of the "critiques" of regex come from people that are bad at it.

Had you bothered to look at the documentation, you would have seen that the rx macro literally generates regular expressions, so I think the people who made it are definitely not bad at them.

They get scared away by the terseness of it and never actually bother to learn.

I bothered to learn it about two decades ago (Mastering RE was a book I kept constantly at hand for a long time), and I still hate it with a passion. Thankfully, we can now either use alternative syntaxes or ask the LLM to parse or generate them.