Jump to ratings and reviews
Rate this book

Introducing Regular Expressions: Unraveling Regular Expressions, Step-by-Step

Rate this book
If you’re a programmer new to regular expressions, this easy-to-follow guide is a great place to start. You’ll learn the fundamentals step-by-step with the help of numerous examples, discovering first-hand how to match, extract, and transform text by matching specific words, characters, and patterns.

Regular expressions are an essential part of a programmer’s toolkit, available in various Unix utlilities as well as programming languages such as Perl, Java, JavaScript, and C#. When you’ve finished this book, you’ll be familiar with the most commonly used syntax in regular expressions, and you’ll understand how using them will save you considerable time.


Discover what regular expressions are and how they work
Learn many of the differences between regular expressions used with command-line tools and in various programming languages
Apply simple methods for finding patterns in text, including digits, letters, Unicode characters, and string literals
Learn how to use zero-width assertions and lookarounds
Work with groups, backreferences, character classes, and quantifiers
Use regular expressions to mark up plain text with HTML5

151 pages, Paperback

First published January 1, 2012

47 people are currently reading
145 people want to read

About the author

Michael J. Fitzgerald

11 books1 follower
Librarian Note: There is more than one author by this name in the Goodreads database.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
29 (22%)
4 stars
52 (40%)
3 stars
40 (31%)
2 stars
8 (6%)
1 star
0 (0%)
Displaying 1 - 13 of 13 reviews
Profile Image for Martin.
92 reviews65 followers
November 4, 2016
I liked the slowness of it but I think there should have been more exercises. It also leans heavy on Perl, which I found good, though unexpected.
Profile Image for Dmitry Demidov.
449 reviews14 followers
September 20, 2017
Отличная книга для введения в тему. Пошаговый разбор от простого к сложному с примерами
Profile Image for Louis.
226 reviews30 followers
September 2, 2012
This is not the first time I've tried to learn Regular Expressions. But other than some basic syntax, it never clicked. But I think this book provided the kind of introduction I needed to get me to not just know the syntax, but to get an understanding of how regular expressions work and how to learn its power. In short, it is not a reference, but a book that teaches me how to learn. And that is what I had not had before.

I've come across regular expressions on numerous occasions in the course of figuring out how to do tasks in various programming languages and tools, but I always found the idea of actually learning it daunting. And when opportunities came up, I generally figured out some Frankenstein combination of tools, functions, and macros that could get the job done.

What Michael Fitzgerald did was not to just give the mechanics of regular expressions, but his exercises lead you through exploring how it works by adding (or subtracting) various expressions so you understand the effects of each feature that is being put to use. The chapters add concepts that demonstrate the power of regular expressions that go well beyond the simple searching that many text or word processing packages use, starting with basic searches and pattern matching and adding markups, boundaries and anchors, back references, groups, alternatives, character classes, unicode, quantifiers, and lookarounds. Each step built up understanding and by the time I got to the last chapter I realized that I actually understood much of the new (to me) concepts that give regular expressions capabilities beyond search and replace that I was used to having in my tools.

Another useful feature of the book is the introduction of numerous tools to help work with regular expressions. He covers a few websites that help test regular expressions as well as features or add-ins for a number of text editors. He also covers how regular expressions are used inside some Unix tools such as grep, sed, and awk.

One thing that is confusing are various dialects of regular expressions. As he goes and switches between websites, Fitzgerald mentions that some of the features don't work in all the websites or tools covered. But he does not explain how to tell the difference. I half remember hearing about various dialects of regular expressions (for example, Fitzgerald mentions that grep does not have full capabilities) but some identification of this may have been helpful, so you can match the various tools you are using with the development environments you work with. So instead of observing that different tools are different, he could have identified some major dialects, and matched the tool to the dialect of regular expression (e.g. grep, perl, java, javascript). Even better, pick a dialect for the book, state up front that the book is based on a single dialect (in keeping with the fact that this is a pure introduction), and identify key areas where dialects may differ as you go.

Overall, highly recommended introduction to regular expressions. In my work in data analysis, I am at the point where I realize that I need to be able to process text automatically as the volume is too much to make doing this manually practical. I already surprise my colleagues with my ability to automate much analysis (they generally use MS Excel). Regular Expressions will enable what is indistinguishable to magic.

Disclaimer: I received a free electronic copy of this book as part of the O'Reilly Blogger program.
Introducction to Regular Expressions by Michael Fitzgerald



Profile Image for David Cross.
Author 3 books5 followers
January 13, 2013
Very slim introduction to regular expressions. I noticed a couple of errors that I'll report to O'Reilly. But if you want a quick read to get you up to speed with regular expressions then this will probably do the trick.
Profile Image for Giuseppe D.
279 reviews65 followers
May 20, 2017
Good introduction I think. It's good that it provides a few texts to play with and doing the exercises while reading along makes learning much easier. Some of the tools are a bit dated but you can just google equivalent ones. Also, it focuses a lot on Perl so I skipped some parts. Pretty sure I won't remember all the special characters and I will continue to google them most of the time but it's useful to know the main ones and to know what tools are out there and what they're called (positive/negative lookaheads and lookbehinds for instance).
Profile Image for Jeff.
Author 18 books38 followers
April 30, 2018
For such a short book, this goes into too much detail on on line regex simulators and on different implementations of regex, rather than just sticking to the basics.
227 reviews1 follower
October 30, 2015
1. połowa podręcznika to rozdziały, dużo obrazków, więc czyta się ją bardzo szybko. Zaletą tej książki jest, że wyrażenia regularne są opisane w najróżniejszych programach, i to bardzo przystępnie. Jest ona raczej dla początkujących, ale mających jako takie doświadczenie z komputerem. Druga połowa to oznaczenia, opisy innych książek, kody znaków (dobrze, że nie chińskich, bo wtedy tom byłby gruuuby), inne kody, słowniczek, zapchane czym się da. Niestety tylko 3 gwiazdki, za małą ilość treści, jednak to jest pozycja do której często będę wracał.
Profile Image for Patrick.
164 reviews
February 4, 2013
I've updated my review from 4 to 5 stars as the practical application for what it taught me have started to show. I've saved quite a bit of time already due to what I've learned from this book.

I now have three things I will quote at people:
"The most elemental problem people have with technology is literacy"
"Excel is evil and lies!"
"If you work with a lot of text you owe it to yourself to learn RegEx"
Profile Image for Liz C.
5 reviews1 follower
July 22, 2016
Great book about regex, clear and practical examples.
Displaying 1 - 13 of 13 reviews

Can't find what you're looking for?

Get help and learn more about the design.