this post was submitted on 14 Feb 2025
889 points (98.5% liked)

Programmer Humor

21279 readers
1063 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 13 points 3 weeks ago (16 children)

Never debug regex, just generate a new one. It's not worth the hassle to figure out not only what it does, but what it was meant to do.

Better yet, just write it out in code, and never use regex. Tis a stupid thing that never should have been made.

[–] [email protected] 16 points 3 weeks ago* (last edited 3 weeks ago) (13 children)

Hard disagree. The function regex serves in programs like Notepad++ can't be easily replaced by "writing it out in code". With a very small number of characters you can get complex search patterns and capturing groups. It's hard to read but incredibly useful.

[–] chad 1 points 3 weeks ago (1 children)

I fall in the abandon it camp. Code is read way more times than it is written. I'd rather read an algorithm that validates input than read a regex that validates input.

[–] [email protected] 4 points 3 weeks ago

You're discussing a completely different use case from what I said. RegEx can be increidbly useful but it's not always the only/best option.

load more comments (11 replies)
load more comments (13 replies)