Mastering Regular Expressions Powerful Techniques for Perl and Other Tools

By Jeffrey E. F. Friedl
First Edition  January 1997 
Pages: 368
ISBN 10: 1-56592-257-3 | ISBN 13: 9781565922570
starstarstarstarstar (Average of 7 Customer Reviews)

This book has been updated—the edition you're requesting is OUT OF PRINT. Please visit the catalog page of the latest edition.

The latest edition is also available on Safari Books Online.

Book description

Regular expressions, a powerful tool for manipulating text and data, are found in scripting languages, editors, programming environments, and specialized tools. In this book, author Jeffrey Friedl leads you through the steps of crafting a regular expression that gets the job done. He examines a variety of tools and uses them in an extensive array of examples, with a major focus on Perl.
Full Description

Regular expressions are a powerful tool for manipulating text and data. If you don't use them yet, you will discover in this book a whole new world of mastery over your data. If you already use them, you'll appreciate this book's unprecedented detail and breadth of coverage. If you think you know all you need to know about regular expressions, this book is a stunning eye-opener. With regular expressions, you can save yourself time and aggravation while dealing with documents, mail messages, log files -- you name it -- any type of text or data. For example, regular expressions can play a vital role in constructing a World Wide Web CGI script, which can involve text and data of all sorts. Regular expressions are not a tool in and of themselves, but are included as part of a larger utility. The classic example is grep. These days, regular expressions can be found everywhere, such as in:
  • Scripting languages (including Perl, Tcl, awk, and Python)
  • Editors (including Emacs, vi, and Nisus Writer)
  • Programming environments (including Delphi and Visual C++)
While many of these tools originated on UNIX, they are now available for a wide variety of platforms, including DOS/Windows and MacOS, so you can use them in your home environment. Additionally, many favorite programming languages offer regular-expression libraries, so you can include support for them in your own programs, and yes, even applets. There can be certain subtle, but valuable, ways to think when you're using regular expressions, and these can be taught. Jeffrey Friedl has spent years helping people on the Net understand and use regular expressions. In this book he leads you through the steps of knowing exactly how to craft a regular expression to get the job done. Regular expressions are not used in a vacuum. In this book, a variety of tools are examined and used in an extensive array of examples, with a major focus on Perl. Perl is extremely well endowed with rich and expressive regular expressions. Yet what is power in the hands of an expert can be fraught with peril for the unwary. This book will help you navigate the minefield to becoming an expert.

Browse within this book

Cover | Table of Contents | Index | Sample Chapter | Colophon




Featured customer reviews

Write a Review


Mastering Regular Expressions Review,  June 25 2002
Rating: StarStarStarStarStar
Submitted by Chris Nestor   [Respond | View]

Well authored and well edited. The 2 years of effort the author says he gave

this book really shows itself. He sells you on the benefit of "hanging in" there through the book, as well as the world of programming power which will be available to you when you indeed "master" regular expressions. Mr. Friedl is sensitive to the various levels of programming expertise his readers will come to the book with. Examples given are strenuously explained--something a budding programmer like myself really appreciates, with nobody to turn to to have my many questions explained. I've never gotten INTO a computer book like I have this one. My deepest appreciation to the author. If he ever attempts another topic I would like to know about it just out of respect for his work ethic as an author. Very impressive.


Mastering Regular Expressions Review,  April 25 2002
Rating: StarStarStarStarStar
Submitted by Chris Widhelm   [Respond | View]

Terrific!

I bought the book with the intention of using it as a refrence and before too long I had read it from cover to cover.


Mastering Regular Expressions Review,  February 15 2002
Rating: StarStarStarStarStar
Submitted by Ashley Grant   [Respond | View]

This book isn’t good. To call it such would be an insult to the author and O’Reilly. This should be the standard for technical books. Content, style, and delivery are so near perfect it makes other excellent technical books look mediocre. Great job Jeffrey and O’Reilly!

If you at the point in your programming where you are ready to go beyond simply using Regular Expressions to actually understanding them you need this book. If you are just getting started with Regular Expressions you will be ready for anything with this book at hand.



Read all reviews


Mastering Regular Expressions Review,  October 24 2001
Rating: StarStarStarStarStar
Submitted by Emil Wayers   [Respond | View]



It's fantastic. Cannot explain, with, more, words.




Mastering Regular Expressions Review,  July 30 2001
Rating: StarStarStarStarStar
Submitted by Serafim Junior Fagundes   [Respond | View]

WOW!

What an incredible book to read. Jeffrey Friedl made a big effort to describe a not so easy programming technique, into a full comprehensive matter. This isn't an easy subject to write about. The author made a very interesting gift to us all.

The book would need an update though.


Mastering Regular Expressions Review,  February 22 2001
Rating: StarStarStarStarStar
Submitted by Dave Lindquist   [Respond | View]

This is an exceptional book. Mr. Friedl has the rare ability to take a potentially dry subject like Regular Expressions and produce and enlightening, entertaining, and thoroughly addicting book. I especially like his conversational style and inclusion of humorous anecdotes like his experience explaining the term "Regular Expressions" to his Japanese colleagues.

If you don't already know Regular Expressions, you need this book. If you think you already know Regular Expressions like the back of your hand, you really need this book!


Mastering Regular Expressions Review,  November 18 2000
Rating: StarStarStarStarStar
Submitted by Martin A.   [Respond | View]



Have you ever had a school teacher that just loves what he or she is teaching? Loves it so much the lessons become interesting no matter how tedious or difficult the matter of the lessons are? Well, this is a book written in that sprit. I never expected regexes to be fun, but now I am a addict ...

This is a tough book to read through, but it is well written and even a non-programmer like me can enjoy it. On and off it goes so deep into the magic world of regexes I loose my directions, but for the most part it is reasonable hands-on and does teach a lot of good regex common sense.

If you really want to utilise regexes for getting things done -- beyond what search and replace in word processors provide -- this book is a must have. And fun: I had never realised the impact of a thing such as nothingness before I read this book ...


Mastering Regular Expressions Review,  April 21 2000
Submitted by TEd BROWn   [Respond | View]



Two words: Deep Magic.


Mastering Regular Expressions Review,  April 21 2000
Submitted by TEd BROWn   [Respond | View]



Two words: Deep Magic.


Mastering Regular Expressions Review,  August 24 1999
Submitted by Chris X Edwards   [Respond | View]



I did read it straight through up to chapter 7 (which was ostensibly Perl-centric). I felt like much of the material here was for the benefit of people like Larry Wall and John Ousterhout. I'm no dummy (I once wrote a crude "search & replace" facility for an HP48 calculator of all things), but a lot of material was a bit beyond what I would need. I just wanted something to help me do what I needed to do in vi without reading the help docs which don't help at all.

Fortunately everything a mere mortal would ever have to worry about regular expressions is explained quite explicitly in the first 50 pages. Buy the book, read the first 50 pages, learn a lot, and impress your colleagues who browse through the rest of the book...unless you actually are a programming language programmer.


Mastering Regular Expressions Review,  August 21 1999
Submitted by Dave Hummel   [Respond | View]



Tripled my knowledge of regular expressions in just a few pages, and I haven't even finished the whole book. Don't bother trying to learn perl without this book unless you are already a regex Guru!


Mastering Regular Expressions Review,  December 29 1998
Submitted by Grant Hopwood   [Respond | View]



I found this book fantastic. It opened my eyes to the 'real world' of regular expressions, that I never knew before.

This book gave me all the knowledge I needed about how the perl regex engine performs its pattern matching. How to write accurate and effective regexes.

I often manipulate text files hundreds of megabytes in size, and this book was a great lesson in how I could optimize the regexes I was using. Even so much as tripling their processing speeds!

Thanks Jeff!


Mastering Regular Expressions Review,  August 29 1998
Submitted by Julian Olson   [Respond | View]



The book is a spectacular achievement. I ordered it after
reading the TPJ { The Perl Journal } article. I have used
AWK (Thompson Automation compiler) a lot, only recently
discovered PERL, and now feel extremely lucky to have my
eyes opened further by what you have written. You have
struck exactly the right level, and the writing is a
beautiful reflection of clear thinking.




Media reviews "Jeffrey Freidl's book is not a dummies guide; it demands concentration, but it is a good read in its own right. Even though it is intended for programmers working with regex-supported languages and programming environments, it is a valuable resource for informed lay-readers who would like to explore this fascinating field. As the only reference to the art, it should be on the bookshelf of every programmer and anyone who works with large text files."--Major Keary, Book News, 2002 No 5

"Mastering Regular Expressions by Jeffrey Friedl is quite possibly the best programming book I have ever been fortunate enough to read. A straight forward style, combined with an uncanny ability to make sense of what can be a very confusing subject, all combined with the power of getting control of regular expressions make this book a must buy, Covering regular expressions in such a comprehensible way makes this book a must buy all by it's self, but coupling that with the keen insights and real world examples used for Perl and other programming give this book a permanent place on my desktop." --Wes Ritchey, The Internet Eye Magazine, Dec 2000

"The definitive work on regular expressions is Mastering Regular Expressions by Jeffrey E. F. Friedl. For those who want to get the most out of working with regular expressions, I highly recommend this book." --Brad Merrill, January 2001

Read all reviews

See larger cover