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

Author

  • Si Dunn is a novelist, screenwriter, photojournalist, and book reviewer. His published books include: DARK SIGNALS, a Vietnam War memoir; ERWIN'S LAW, a private-detective novel; and JUMP, a novella about a combat veteran suffering from PTSD and alienation while trying to work for newspapers as a journalist. Several of his feature screenplays recently were under option to movie producers. He spent nearly 15 years working as a technical writer and software tester in the telecommunications industry. His current programming interests include Go, JavaScript, Python, R, Angular, and other languages and frameworks. He is a U.S. Navy veteran and a graduate of the University of North Texas.

Leave a Reply

%d bloggers like this: