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.

Banner

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.

Conclusion

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.

Banner


Nine Algorithms That Changed the Future

Author: John MacCormick
Publisher: Princeton U P, 2011
Pages: 248
ISBN: 978-0691158198
Print: 0691158193
Kindle: B005Z67EI0
Audience: General reader interested in computing
Rating: 4
Reviewed by: Mike James

Nine algorithms that changed the future - but which nine?



Introduction to Game Design, Prototyping, and Development 2nd Ed

Author: Jeremy Gibson Bond
Publisher: Addison Wesley
Pages: 1024
ISBN: 978-0134659862
Print: 0134659864
Kindle: B074WBLTPG
Audience: Game developers
Rating: 1 or 5 (see conclusion)
Reviewer: David Conrad
Unity, my fellow programmers... the graphics engine that is. This is a mixed book and give [ ... ]


More Reviews

Last Updated ( Friday, 30 November 2018 )