Wednesday, July 06, 2011

Regular Expressions

I was setting up a sed script last week when I realized that I needed a regular expression. No big deal right, Google is your friend and I should just be able to find it quickly. I can never do things the easy way though.

I went on a search to improve my limited understanding of regex. I found it...a book. Sam's Teach Yourself Regular Expressions in 10 minutes. I'm not normally a fan of the Sams Teach Yourself line. First off with work, school, and classes finding extra time to read something "on the side" is more than problematic (just ask my growing collection of unread Asimov's Sci-Fi). Secondly, I have found  in the past that the tutorials in the Sams books have been inadequate for what I was needing. I am pleasantly wrong about this book.

The examples are simple, to the point, and reasonably well explained with each lesson building on the last with good results. Being able to use this in command line with grep is solidifying my grep practice as well. I'm hitting one chapter each morning just after normal studies and before my sysadmin jobs starts. Completing a chapter and being able to use what I learned throughout the day is a pleasant feeling and quite rewarding.

Now I just need to see if they produce a vi book, I'm probably the last emacs holdout in North Texas and the pressure is mounting, the senior unix admin refuses to let me install emacs or nano on any of the solaris boxes.

If you want to beef up on regex, check out the book. I believe I got it from Amazon for about $11. I would also recommend getting a copy of the Added Bytes Cheat Cheets, which is an excellent resource for regex as well as many other programming topics. You can find Added Bytes here.

No comments: