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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
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.
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.
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.