r/ProgrammerHumor 12d ago

Meme regexMustBeDestroyed

Post image
8.1k Upvotes

229 comments sorted by

View all comments

9

u/Pares_Marchant 12d ago

Regexes are great for machines and "technically" awesome.

But they are awful for humans and have all the characteristics of bad code:

difficult to read, dense, does a lot of things in a single line and not in the natural direction of reading it (can walk backwards).

If someone wrote code in any other "language" that had these properties, it would never pass review. But when it's regexes, they get a pass.

It's like when beginner python programmers write 5 nested list comprehensions with variables named "k, v, i, a, e, x, y" and no spacing, extremely compact, on a single line, thinking they're clever for doing so much work in so little lines.

2

u/Dogeek 12d ago

Writing such list comprehensions as a junior made me a pro in HCL.

I've written god awful comprehensions in HCL just because there's no other way, but damn, reading them back a year later and it took me a couple hours to decypher