Regular Expressions May Be The Most Powerful Dev Tool I’ve Ever Learned

I started programming in 1986 when I got my first computer at age 13. It was an Apple IIc and the primary language on that machine was BASIC, so that’s what I learned. I exclusively programmed in BASIC until 1989 when my high school got Macintoshes and we spent the next two years working in Pascal.

When I graduated from high school I stopped programming for a few years. I started again in 1994, the year I moved to Oregon, and programmed steadily until 2001. In those years I learned C, a little assembly language, a little Microsoft’s foundation classes and finally Palm OS’ libraries. I also worked in BASIC for Excel and Access.

In 2001 my development team kicked me out of the dev room and told me to go focus on the business, which I did until the company shrunk again and I had to write code. That year was 2007. I learned Java and the Blackberry OS’ libraries, learned Ruby and Rails, and then got back into C development, this time with iOS’ libraries and Objective-C. I focused on Rails and iOS for the next few years before I started learning Javascript last summer. In the last year I’ve written more Javascript then Objective-C.

I left off one “language” that I’ve learned in the last year, probably the one I find most powerful and flexible: regular expressions. Regular expressions, or RegEx for short, is a way of finding and pattern matching text. It is unbelievably powerful and fairly easy to learn the basics. I thought I’d learn a little RegEx, use it a little bit, and never really need it again.

Not only does it turn out that Equals uses them constantly, I’ve also found other uses as well. For instance, my daughters’ school needed some content extracted from email messages. This task would have been impossible without regular expressions, and was so thankful I knew them before I started.

The book I learned with is Mastering Regular Expressions by Jeffrey Friedl. I also use a Mac app called Oyster, which allows me to write expressions, set up tests so I can verify that my changes work, and then copy my RegEx to the clipboard in one of 12 different languages that supports regular expressions.

If you write code or process text and haven’t spent any time learning RegEx, I highly recommend it.