Regular Expressions: Pocket Primer
Written by Alex Armstrong   

Author: Oswald Campesato
Publisher: Mercury Learning & Information
Date: July 2018
Pages: 190
ISBN: 978-1683922278
Print: 1683922271
Kindle: B07FK4NHWQ
Audience: Those who want to understand regexes
Rating: 3
Reviewer: Alex Armstrong
Regular expressions are tough to remember so a pocket primer sounds like a good idea.

We all know that regular expressions are useful but they also have a reputation for being difficult. The problem is partly that there are so many different symbols with slightly different meanings in different languages. Even in this web oriented day and age a pocket book that lets you find out the details you need seems like a good idea.


Chapter one deals with more less the whole idea of a regular expression. It does it by presenting sections that deal with "working with x" where x is some metacharacter or other. The is no background on the basic idea of a regular expression i.e. a type of grammar. It treats the problem as one of working your way though increasingly specialized metacharacters. I don't particularly like this approach but another reader might.

 Chapter 2 is a set of common examples - phone numbers, zip codes, email addresses and so on. For many readers this might well be the most valuable part of the book. It also introduces the idea of capture and back references which personally I consider to be the point at which regular expressions become truly complicated. I would have preferred a more focused look at the idea of capture and groups. The section on testing also got me excited - I've wanted to know how to test a regular expression for a long time. I still want to know.


The rest of the book consists of three chapters on each of the following languages - Python,  R and bash. There are also two appendices on Perl and Java. It does make sense to deal with the idiosyncrasies of particular language implementations of regular expressions but what about JavaScript or C#?

It is also generally held that Perl, Java and Python use a regular expression syntax that is very close. The bash syntax or more accurately the POSIX regular expression syntax is the big alternative and also used by C and C++. I think there might be a better way to summarize the variations in regular expressions across languages.


This is a book packed with lots of examples and, even better, useful examples. It doesn't really manage to make regular expressions simpler to understand, however. There is a lot of logic behind how regular expression work and this isn't made particularly clear. A pocket primer probably should have lots of tables and charts summarizing how things work and this one doesn't. The final chapters, focusing on different languages are, of course, only going to be useful if the languages are ones you use.

This isn't a bad book but it is one that is likely to be useful only to a very specific group of readers. Writing a really good book on regular expressions is probably much harder than it seems.


To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.


Learning React, 2nd Ed

Author: Kirupa Chinnathambi
Publisher: Addison Wesley
Date: June 2018
Pages: 304
ISBN: 978-0134843551
Print: 013484355X
Kindle: B07CQPL2BM
Audience: Would-be web developers
Rating: 4.5
Reviewer: Ian Elliot

React - the new kid on the block, but this book is a 2nd edition. Not so young any more.

Making Simple Robots

Author: Kathy Cerceri
Publisher: Maker Media
ISBN: 9781457183638
Print: 1457183633
Kindle: B00U1VU2AQ
Audience: 4
Rating: Young makers and their parents/teachers
Reviewer: Harry Fairhead

The subtitle of this book is: Exploring Cutting-Edge Robotics with Everyday Stuff. How can " [ ... ]

More Reviews

Last Updated ( Friday, 30 November 2018 )