Regular Expressions Cookbook (2e)

Author: Jan Goyvaerts & Steven Levithan
Publisher: O'Reilly
Pages: 612
ISBN: 978-1449319434
Audience: Developers who need practical help
Rating: 4.5
Reviewer by: Ian Elliot

Regular expressions are useful and powerful. They really do deserve a book in their own right and this one shows you how to use them.

As long as you take the "cookbook" idea seriously, this is a useful book. It contains recipes for regular expressions for a wide range of situations - validating URLs, ISBNs, XML, numbers, emails and so on. This is the second edition and it contains one new chapter and many minor revisions. The new chapter deals with parsing logs, which is a very common use of regular expressions.

 

Banner

 

The regular expressions presented work with a range of languages - Java, C#, Perl, JavaScript, PHP, Python, Ruby and VB.NET. It starts off by highlighting some of the problems with working with a range of regular expression engines and the biggest problem of all - the way replacement text has been implemented differently in different engines.

If you only want to validate a string then regular expressions are, well, fairly regular. If you want to do the equivalent of a search and replace, things aren't so easy as the replacement text option has be something that designers have bolted on to their implementations.

Each recipe starts off with the problem statement and some solutions, with an indication of what flavours of regular expression engine they work with. A discussion follows and for most programmers this is going to be the meat of the recipe. The discussions give you a good idea how the regular expressions work and how to modify them. Initially the problems start off fairly low level and general, such as how to match any character, and work their way up to much more complex matching such as a valid URL or ISBN. Occasionally an additional chunk of code is given to go beyond a regular expression - for example computing the checksum on an ISBN number.

 

regularexpressioncookbooke2

 

 

Overall, the book is useful if you want to extend your knowledge of regular expressions or if you really do need help with a specific problem. It is also useful if you want to compare how different languages treat regular expressions.

What the book isn't so good at is teaching you the theory that underpins regular expressions and it doesn't give you much of an idea how to go about building your own from scratch or how to test that they work. If you already know the basics, however, it does provide a lot of examples of real practical regular expressions.

If what you really want is a cookbook then this is as good as it gets.

 

Banner


Windows Phone 7 Programming for Android and iOS Developers

Author: Zhinan Zhou, Robert Zhu, Pei Zheng & Baijian Yang
Publisher: Wrox, 2011
Pages: 360
ISBN: 978-1118021972
Aimed at:
Rating: 3
Pros: Presents similarities and differences between phones
Cons: Insufficient detail on Windows Phone 7
Reviewed by: Harry Fairhead

A book that compares the three major ph [ ... ]



Erlang and OTP in Action

Author: Martin Logan,Eric Merritt, and Richard Carlsson
Publisher: Manning, 2010
Pages: 500
ISBN: 978-1933988788
Aimed at: Programmers familiar with concurrency
Rating: 4.5
Pros: Introduces Erlang in a modern and appropriate way
Cons: Not for complete beginners
Reviewed by: Alex Armstrong

Erlang isn't the [ ... ]


More Reviews

Last Updated ( Thursday, 21 February 2013 14:45 )
 
 

   
RSS feed of book reviews only
I Programmer Book Reviews
RSS feed of all content
I Programmer Book Reviews
Copyright © 2013 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.