Regular Expressions Cookbook, 2nd Edition – Seek, find, fix–in 8 programming languages – #bookreview

Regular Expressions Cookbook, 2nd Edition
Jan Goyvaerts and Steven Levithan
(O’Reilly, paperbackKindle)

Recently revised and updated, this new edition of the Regular Expressions Cookbook offers “detailed solutions” for using regular expressions in eight popular programming languages: C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET.

A regular expression basically is a pattern that describes a certain amount of text. And: “Regular expressions are a powerful tool,” the two authors note. “If your job involves manipulating or extracting text on a computer, a firm grasp of regular expressions will save you plenty of overtime.”

Programmers and non-programmers alike can use regular expressions “for information retrieval and alteration tasks,” and no prior experience is required to use the first two chapters of this book. Chapters 1 and 2 explain major concepts, basic skills, and many of the available regex software tools that non-programmers can use to work with regular expressions.

For programmers, Chapters 3 through 9 focus on using the book’s eight supported programming languages to implement and work with regular expressions. And there are numerous code examples.

The Regular Expressions Cookbook is well-written and well-illustrated, and it delivers more than 140 “recipes” that show how to apply regular expression concepts and tools to real-world problems.

One Cookbook example: “You want to catch addresses that contain a P.O. box, and warn users that their shipping information must contain a street address.”

Another example: “You want to find URLs in a large body of text. URLs may or may not be enclosed in punctuation that is part of the larger body of text rather than part of the URL. You want to correctly match URLs that include pairs of parentheses as part of the URL, without matching parentheses placed around the entire URL.”

The Regular Expressions Cookbook explains why there are now many different “flavors” of regular expressions. And, while some programming languages “have their own, built-in regular expression flavor….[other] programming languages rely on libraries for regex support.” The authors emphasize: “For this book , we selected the most popular regex flavors in use today.”

Si Dunn

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s