Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

I love regexes. In addition to doing cool things and saving time, I feel like I'm a "real programmer" whenever I write a good one.


sort by: page size:

Very cool! I think most of us would admit we spend more time than we'd like on regex.

I love regex. Not just for doing pattern matching in code, but for searching and data transformation in editors and tools.

But yes, lots of people do seem to do the "I suck at regex". Even when I notice people do crazy long winded transformations by hand which I then do within seconds. Still doesn't seem enough motivation for them to learn them properly.


It's great for writing regex.

For what it's worth, I am not an expert on regex's. A few times a year I might write a very simple regex for something that would otherwise require a lot of tedious repetition.

They're just another thing I find intellectually interesting and my comments are based on my struggles to learn them as a non-developer.


As I get more experienced in operations, I find regex to be more and more invaluable. I used to dread doing a regex, now I get enjoyment out of sorting out a tricky one.

of all the things ever invented in software, regex still amazes me.

It's almost like nature, many simple rules coming together to make extremely clever and fairly complex ideas


I love using regexes whenever I need a way to parse HTML. Also whenever I parse nested parentheses, brackets, or braces.

Writing regexes is one of the most fun things that sometimes pop up at work. A little puzzle. Well-defined, clear that there must be a solution, somewhat easily checkable .. the easiest kind of task. I enjoy this just as much as some people enjoy crosswords or sudoku. Nobody would ask chatgpt to solve a sudoku for them (It would get them all wrong anyway.) No way I'm gonna let GPT take this away from me.

This is really neat! I've been putting off learning regex's for some time now, guess I need to add it to my tool belt.

I’m pretty decent with regex, but I often break complex regexes down into multiple steps for better clarity and easier debugging. Sure, you can use extremely clever one-liners, but the next maintainer of your code may hunt you down and murder you on the spot for wasting weeks of their time.

This is awesome but.... I don't hate regex. Matter of fact, I love regex.

Inspiring post - I'll be sure to put extra thought into how I write my regexes from here on out.

Does anyone know a good browser-based game that trains you to do regexes well?


Most of the complex regexes I write fall into the category of stuff I don’t understand that might work. I’m no slouch at regexes either but when you start trying to do weird data processing stuff that handles all kinds of edge cases the wheels really come off quick.

Elegant regexes are almost unheard of in real world no matter if it's e-mail or anything else.

Regex is great and I love it, but the greatest trick is to know when you need to write a parser instead.

This is wonderful. I love to see technology enhancing experts' ability to do what they already do, but faster/more accurately.

Also, I'm a big fan of regex. I think -- probably thanks to jwz's famous quote -- a lot of younger programmers avoid them but they're fantastic for MATCHING. Using them in a Google sheet is a killer MVP to prove out something like this.


I'm good at reading/writing regex and use them a lot, but I always worry about their maintainability. They're a common source of hard-to-pinpoint bugs.

I suppose I still use them because I don't know of a better way to do things.


Regex101 is actually awesome. It's what I reach for whenever I've got to do stuff in regex.

This is great! I find myself always using an online code tool to figure out and test the appropriate regex.
next

Legal | privacy