Organization
The nine chapters of this book can be logically divided into roughly three parts.
Here's a quick overview:
-
The Introduction
-
Chapter 1 introduces the concept of regular expressions.
Chapter 2 takes a look at text processing with regular expressions.
Chapter 3 provides an overview of features and utilities, plus a bit of history.
-
The Details
-
Chapter 4 explains the details of how regular expressions work.
Chapter 5 works through examples, using the knowledge from Chapter 4.
Chapter 6 discusses efficiency in detail.
-
Tool-Specific Information
-
Chapter 7 covers Perl regular expressions in detail.
Chapter 8 looks at regular-expression packages for Java.
Chapter 9 looks at .NET's language-neutral regular-expression package.
The Introduction
The introduction elevates the absolute novice to "issue-aware" novice. Readers
with a fair amount of experience can feel free to skim the early chapters, but I particularly
recommend Chapter 3 even for the grizzled expert.
Chapter 1, Introduction to Regular Expressions, is geared toward the complete
novice. I introduce the concept of regular expressions using the widely available
program egrep, and offer my perspective on how to think regular expressions,
instilling a solid foundation for the advanced concepts presented in later
chapters. Even readers with former experience would do well to skim this first
chapter.
Chapter 2, Extended Introductory Examples, looks at real text processing in a
programming language that has regular-expression support. The additional
examples provide a basis for the detailed discussions of later chapters, and
show additional important thought processes behind crafting advanced regular
expressions. To provide a feel for how to "speak in regular expressions," this
chapter takes a problem requiring an advanced solution and shows ways to
solve it using two unrelated regular-expression—wielding tools.
Chapter 3, Overview of Regular Expression Features and Flavors, provides an
overview of the wide range of regular expressions commonly found in tools
today. Due to their turbulent history, current commonly-used regular-expression
flavors can differ greatly. This chapter also takes a look at a bit of the history
and evolution of regular expressions and the programs that use them. The
end of this chapter also contains the Guide to the Advanced Chapters. This
guide is your road map to getting the most out of the advanced material that
follows.
The Details
Once you have the basics down, it's time to investigate the how and the why. Like
the "teach a man to fish" parable, truly understanding the issues will allow you to
apply that knowledge whenever and wherever regular expressions are found.
Chapter 4, The Mechanics of Expression Processing, ratchets up the pace several
notches and begins the central core of this book. It looks at the important
inner workings of how regular expression engines really work from a practical
point of view. Understanding the details of how a regular expressions are
handled goes a very long way toward allowing you to master them.
Chapter 5, Practical Regex Techniques, then puts that knowledge to high-level,
practical use. Common (but complex) problems are explored in detail, all with
the aim of expanding and deepening your regular-expression experience.
Chapter 6, Crafting an Efficient Expression, looks at the real-life efficiency
ramifications of the regular expressions available to most programming languages.
This chapter puts information detailed in Chapters 4 and 5 to use for
exploiting an engine's strengths and stepping around its weaknesses.
Tool-Specific Information
Once the lessons of Chapters 4, 5, and 6 are under your belt, there is usually little
to say about specific implementations. However, I've devoted an entire chapter to
each of three popular systems:
Chapter 7, Perl, closely examines regular expressions in Perl, arguably the
most popular regular-expression—laden programming language in use today. It
has only four operators related to regular expressions, but their myriad of
options and special situations provides an extremely rich set of programming
options — and pitfalls. The very richness that allows the programmer to move
quickly from concept to program can be a minefield for the uninitiated. This
detailed chapter clears a path.
Chapter 8, Java, surveys the landscape of regular-expression packages available
for Java. Points of comparison are discussed, and two packages with
notable strengths are covered in more detail.
Chapter 9, .NET, is the documentation for the .NET regular-expression library
that Microsoft neglected to provide. Whether using VB.NET, C#, C++, JScript,
VBscript, ECMAScript, or any of the other languages that use .NET components,
this chapter provides the details you need to employ .NET regular-expressions
to the fullest.
|