DEV Community

Discussion on: What are your code smells and/or best practices with regular expressions?

Collapse
 
jorinvo profile image
jorin • Edited

Regular expressions can be really quick solutions to complex parsing problems.
But at a certain level of complexity or performance requirements a custom solution (usually some sort of state machine) is better suited.

If you see a regular expression as a good fit, please always leave a detail comment above it.

In case someone is trying to figure out if a RegEx is the right fit for their HTML parsing problem here is my favorite post on that topic.