•Chapter 6, Crafting an Efficient Expression,looks at the real-life efficiency
ramifications of the regular expressions available to most programming lan-
guages. 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 Infor mation
Once the lessons of Chapters 4, 5, and 6 areunder your belt, thereisusually little
to say about specific implementations. However,I’ve devoted an entirechapter to
each of four popular systems:
•Chapter 7, Perl,closely examines regular expressions in Perl, arguably the
most popular regular-expr ession–laden pr ogramming 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,looks in detail at the java.util.regex regular-expr ession
package, a standard part of the language since Java 1.4. The chapter’s primary
focus is on Java 1.5, but differ ences in both Java 1.4.2 and Java 1.6 arenoted.
•Chapter 9, .NET,isthe documentation for the .NET regular-expr ession 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-expr essions
to the fullest.
•Chapter 10, PHP,provides a short introduction to the multiple regex engines
embedded within PHP,followed by a detailed look at the regex flavor and API
of its preg regex suite, powered under the hood by the PCRE regex library.
Typog raphical Conventions
When doing (or talking about) detailed and complex text processing, being pre-
cise is important. The mereaddition or subtraction of a space can make a world of
dif ference, so I’ve used the following special conventions in typesetting this book:
• Aregular expression generally appears like
!this".Notice the thin corners
which flag “this is a regular expression.”Literal text (such as that being
searched) generally appears like ‘this’. At times, I’ll leave offthe thin corners
or quotes when obviously unambiguous. Also, code snippets and screen shots
ar e always presented in their natural state, so the quotes and corners arenot
used in such cases.
Preface xxi
2July 2006 02:01