Last Updated: February 25, 2016
· baustin213

The Developer’s RegEx Survival Guide: 15 Rules for Making Sense of Regular Expressions

Regular expressions are a powerful, expressive and compact way to solve many programming problems involving text. Yet when I help people on StackOverflow, I see a lot of pain and anguish from people misusing regexes, or not knowing the common pitfalls. In this article, I give pointers to help newcomers learn how best to use these tools. These rules should help save you from the heartache of debugging.

Most of my examples are in Perl because Perl is the granddaddy of all the programming languages as far as regex support. While the syntax for working with regexes is different in languages like PHP, Ruby, or Java, the principles are the same. [Continue reading.]