DEV Community

Discussion on: A Visual Guide to Regular Expression

Collapse
 
eecolor profile image
EECOLOR

Good write! When I explain regular expressions I tend to mention the following points:

  • Once you learn regular expressions, please remember that you barely ever need them. Things tend to look like regex nails ;-)
  • If your regular expression starts to look back at you in an intimidating fashion, you are probably better off using something else.
  • You should not use a regular expression for things that involve nesting (code, html, ...)

I also point people towards RegExr, especially the 'Tests' tab is amazing, make sure you also write tests for the things you do not want to match.

Collapse
 
dougaws profile image
Doug

The greatest danger using regular expressions is a global search and replace. I can't tell you how many times I've seen inadvertent changes cause down stream problems.

Collapse
 
amitness profile image
Amit Chaudhary

Great to know. I'll update the post with a link to Regexer.