失效链接处理 |
Mastering Regular Expressions(3rd) PDF 下载
本站整理下载:
相关截图:
![]()
主要内容:
This book is about a powerful tool called “regular expressions”. It teaches you how
to use regular expressions to solve problems and get the most out of tools and
languages that provide them. Most documentation that mentions regular expressions doesn’t even begin to hint at their power, but this book is about mastering
regular expressions.
Regular expressions are available in many types of tools (editors, word processors,
system tools, database engines, and such), but their power is most fully exposed
when available as part of a programming language. Examples include Java and
JScript, Visual Basic and VBScript, JavaScript and ECMAScript, C, C++, C#, elisp, Perl,
Python, Tcl, Ruby, PHP, sed, and awk. In fact, regular expressions are the very
heart of many programs written in some of these languages.
Ther e’s a good reason that regular expressions are found in so many diverse languages and applications: they are extr emely power ful. At a low level, a regular
expr ession describes a chunk of text. You might use it to verify a user’s input, or
perhaps to sift through large amounts of data. On a higher level, regular expressions allow you to master your data. Control it. Put it to work for you. To master
regular expressions is to master your data.
The Need for This Book
I finished the first edition of this book in late 1996, and wrote it simply because
ther e was a need. Good documentation on regular expressions just wasn’t available, so most of their power went untapped. Regular-expr ession documentation
was available, but it centered on the “low-level view.” It seemed to me that they
wer e analogous to showing someone the alphabet and expecting them to learn to
speak.
xvii
2 July 2006 02:01
xviii Preface
The five and a half years between the first and second editions of this book saw
the popular rise of the Internet, and, perhaps more than just coincidentally, a considerable expansion in the world of regular expressions. The regular expressions
of almost every tool and language became more power ful and expressive. Perl,
Python, Tcl, Java, and Visual Basic all got new regular-expr ession backends. New
languages with regular expression support, like PHP, Ruby, and C#, were developed and became popular. During all this time, the basic core of the book — how
to truly understand regular expressions and how to get the most from them —
remained as important and relevant as ever.
Yet, the first edition gradually started to show its age. It needed updating to reflect
the new languages and features, as well as the expanding role that regular expressions played in the Internet world. It was published in 2002, a year that saw the
landmark releases of java.util.regex, Micr osoft’s .NET Framework, and Perl 5.8.
They were all covered fully in the second edition. My one regr et with the second
edition was that it didn’t give more attention to PHP. In the four years since the
second edition was published, PHP has only grown in importance, so it became
imperative to correct that deficiency.
This third edition features enhanced PHP coverage in the early chapters, plus an all
new, expansive chapter devoted entirely to PHP regular expressions and how to
wield them effectively. Also new in this edition, the Java chapter has been rewritten and expanded considerably to reflect new features of Java 1.5 and Java 1.6.
Intended Audience
This book will interest anyone who has an opportunity to use regular expressions.
If you don’t yet understand the power that regular expressions can provide, you
should benefit greatly as a whole new world is opened up to you. This book
should expand your understanding, even if you consider yourself an accomplished
regular-expr ession expert. After the first edition, it wasn’t uncommon for me to
receive an email that started “I thought I knew regular expressions until I read
Mastering Regular Expressions. Now I do.”
Pr ogrammers working on text-related tasks, such as web programming, will find
an absolute gold mine of detail, hints, tips, and understanding that can be put to
immediate use. The detail and thoroughness is simply not found anywhere else.
Regular expressions are an idea— one that is implemented in various ways by various utilities (many, many more than are specifically presented in this book). If you
master the general concept of regular expressions, it’s a short step to mastering a
particular implementation. This book concentrates on that idea, so most of the
knowledge presented here transcends the utilities and languages used to present
the examples.
|