Regex Books and Resources
This page contains two main sections:
✽ Regex Books
✽ Online Regex Resources
Regex BooksOf the four books about regular expressions I have seen, two O'Reilly books are well worth reading. They are different, and if you fall in love with regex, you will probably want to read both.
The one to start with is Jan's Regular Expressions Cookbook. The first two chapters give you a quick ramp-up to regular expressions. The third chapter shows you how to perform a number of regex operations in various programming languages. (If you use RB, you may recognize the kind of code output by the Use panel.) In cookbook fashion, the remaining five chapters present recipes for many of the tasks you might want to accomplish with regex. If you use RegexBuddy, you will see a parallel between the choice of recipes and the patterns in the RB library.
Eventually, the book you will want to study is Jeffrey Friedl's Mastering Regex Expressions. The first three chapters make a solid introduction to regex. Chapters 4 and 5 are excellent reads about advanced regex. Chapter 6 contains a fascinating discussion of techniques to optimize your expressions. The four remaining chapters each focus on using regular expressions in a particular context: Perl, .NET, Java and PHP.
O'Reilly also has a Regular Expression Pocket Reference which I find uninteresting.
If you have read this site (or Jan's tutorial), Sams Teach Yourself Regular Expressions in 10 Minutes is a waste of time.
Online Regex ResourcesIn the world of regex-ware, there is one name to remember: JGSoft, or the man behind it, Jan Goyvaerts. You might think that JGSoft stands for "Jan Goyvaerts Software"—but no, it stands for "Just Great Software". Jan seems to have infiltrated the world of regex to its very core. He stands behind:
- a top-notch online regex tutorial
- a regex engine (JGSoft)
- a top text editor (EditPad Pro) that uses the JGSoft regex engine
- very cool regex tools, particularly the absolutely awesome RegexBuddy
- an O'Reilly regex cookbook
I mention that now so you can connect the dots as you cruise through this page and the Tools page.
Online Regex Tutorials and Resources
Apart from this site, for a comprehensive introduction to regular expressions, my favorite is Jan's regex tutorial. The one reproach I would have is that it tends not to document the regex features not yet implemented in Jan's tools such as RegexBuddy. To read this beautiful tutorial offline without copying and pasting lots of pages into a Word document, you can send five bucks to Jan for a pdf. But if you're going to buy or try one of Jan's products, such as EditPad Pro (which has a free trial), you would be paying for a redundant feature as Jan's regex tutorial is conveniently included in his Help files. A tip if you have a Kindle or other ebook reader: using Calibre, a free program, you can convert the CHM file (the help file, e.g. EditPadPro7.chm or RegexBuddy.chm) into an ebook. That's a great way to read the manual (and the tutorial) and to make the most of Jan's products. See this page of Kindle tricks for more details.
Apart from Jan's tutorial…
I find this quick intro to a few "advanced" regex topics quite clean.
Smashing Magazine has a great collection of regex links.
StackOverflow has a brilliant Regex FAQ.
If you don't want to reinvent the wheel, you can try your luck at the regex library, which had over 3,000 expressions last time I checked.
Online regex checkers are mentioned under "Other Tools" on the tools page.
There are a few places online where you can get answers to regex questions.
The most active by far is the regex tag on StackOverflow. The page I sent you to lists the questions that had the most votes. Once you land, you can also click the other tabs to see the newest questions.
As a huge fan of RegexBuddy, I love its forum on regular expressions. It is a private forum that you can only access if you own EditPadPro or RegexBuddy. (Click the links to download a free trial of RegexBuddy or EditPad Pro).
I like the regex forum on the php developers network.
The regex board at PHPfreaks is good too.
So is the regex forum on devshed, though my eyes find it a tad harder to read.
Other Regex Links
This page is a place to start for mySQL regex. But you'll also want to look at the regex(7) man page.
Well, unless you want to go back to the beginning of my sprawling regex tutorial, that's it for now. I wish you a lot of fun on your journey with regular expressions!
Back to the First Page