DEV Community

Discussion on: Progressing from a beginner to intermediate developer

Collapse
 
rbauhn profile image
Robin Bauhn

My favorite quote:
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
Not sure how accurate it is, but it is funny

Collapse
 
fjones profile image
FJones • Edited

Regex is great fun and hugely intuitive - once you get it. Until then, that is very accurate. It's important to know the limitations (and boy am I happy to set up a small state machine instead for a problem that exceeds Regex), and it's important to understand that the basics are all you need.

PCRE et al have a large assortment of additional features that, ultimately, just aren't necessary. If a problem can't be solved with .+()?|[]^$, it's the wrong tool and you're setting yourself up for pain. So yeah, trying to make Regex work for a given problem is usually a problem in itself - unless you already have the solution (at least the theory) in mind.

One of the most common use cases I have found for Regex over the years is just rearranging CSV data. Statistics dumps from product management that they need rearranged, filtered, or turned into database queries. grep and sed on my local shell have seen more of my Regex than any commit or build.

Some comments have been hidden by the post's author - find out more