Updates

Latest Tweet



What's New?

Check out for latest innovation, a computer based training video collection


Like this Page

Java Regular Expressions: Taming the java.util.regex Engine Review by William J. Poser

A lucid explanation of regular expressions

This book provides by far the clearest exposition of regular expressions that I have ever seen. The writing flows nicely and the explanations are lucid, yet one doesn't get the feeling that the material has been dumbed-down. It assumes no knowledge of regular expressions and starts with the basics, but works up to advanced topics such as possessive and reluctant quantifiers and lookaheads.

The focus of the book is how to write regular expressions that will do what you want to do. There is no discussion of the mathematics of regular expressions and their relationship to finite state automata. There is some discussion of optimization, but not a lot of detail. I think that this is appropriate. Most people don't need to know a lot about optimization. Those who do can find the material in Jeffrey Friedl's book Mastering Regular Expressions.

This book deals with regular expressions in the context of Java, but it should be useful to readers who are not using Java. Most of the book deals with aspects of regular expressions that do not depend on the details of Java, and one doesn't have to know Java in order to understand most of the material. Since Java has the most extensive set of regular expression constructs and named character classes of any widely used language, a person who masters Java regular expressions should not find it difficult to adapt that knowledge to other languages. Of course, for someone learning Java the explanation of java.util.regex is quite helpful.

Some other reviews have harped on the errors in the book. It is true that the book has more such errors than is desirable. However, I don't think that these errors are so numerous or so severe as to detract greatly from the book's value. I've used regular expressions frequently for over 25 years in more than 20 languages. That may mean that it is hard for me to take the perspective of a novice, but my experience is that once you have a good grasp of the ideas, it is easy to check details in the documentation.