Regular Expression Pocket Reference Regular Expressions for Perl Ruby PHP Python C Java and NET 2nd Edition Tony Stubblebine - The latest ebook is available for instant download now
Regular Expression Pocket Reference Regular Expressions for Perl Ruby PHP Python C Java and NET 2nd Edition Tony Stubblebine - The latest ebook is available for instant download now
com
https://ebookname.com/product/regular-expression-pocket-
reference-regular-expressions-for-perl-ruby-php-python-c-
java-and-net-2nd-edition-tony-stubblebine/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookname.com/product/regular-expressions-cookbook-1st-
ed-edition-jan-goyvaerts/
https://ebookname.com/product/xml-processing-with-perl-python-
and-php-1st-edition-martin-c-brown/
https://ebookname.com/product/ruby-pocket-reference-2nd-edition-
instant-help-for-ruby-programmers-michael-fitzgerald/
https://ebookname.com/product/soil-physics-with-hydrus-modeling-
and-applications-david-radcliffe/
Rescued from the Reich How One of Hitler s Soldiers
Saved the Lubavitcher Rebbe First Edition Bryan Mark
Rigg
https://ebookname.com/product/rescued-from-the-reich-how-one-of-
hitler-s-soldiers-saved-the-lubavitcher-rebbe-first-edition-
bryan-mark-rigg/
https://ebookname.com/product/schaum-s-outline-of-french-
grammar-5ed-schaum-s-outline-series-5th-edition-mary-crocker/
https://ebookname.com/product/urban-aquaculture-cabi-publishing-
first-edition-barry-costa-pierce/
https://ebookname.com/product/complex-behavior-of-switching-
power-converters-1st-edition-chi-kong-tse/
Nuclear Proliferation and International Security
Routledge Global Security Studies Lodgaard Maerli
https://ebookname.com/product/nuclear-proliferation-and-
international-security-routledge-global-security-studies-
lodgaard-maerli/
Regular Expression
Pocket Reference
SECOND EDITION
Regular Expression
Pocket Reference
Tony Stubblebine
Printing History:
August 2003: First Edition.
July 2007: Second Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are
registered trademarks of O’Reilly Media, Inc. The Pocket Reference series
designations, Regular Expression Pocket Reference, the image of owls, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish
their products are claimed as trademarks. Where those designations appear
in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the
designations have been printed in caps or initial caps.
Java™ is a trademark of Sun Microsystems, Inc. Microsoft Internet Explorer
and .NET are registered trademarks of Microsoft Corporation. Spider-Man
is a registered trademark of Marvel Enterprises, Inc.
While every precaution has been taken in the preparation of this book, the
publisher and author assume no responsibility for errors or omissions, or for
damages resulting from the use of the information contained herein.
ISBN-10: 0-596-51427-1
ISBN-13: 978-0-596-51427-3
[T]
Contents
v
.NET and C# 38
Supported Metacharacters 38
Regular Expression Classes and Interfaces 42
Unicode Support 47
Examples 47
Other Resources 49
PHP 50
Supported Metacharacters 50
Pattern-Matching Functions 54
Examples 56
Other Resources 58
Python 58
Supported Metacharacters 58
re Module Objects and Functions 61
Unicode Support 64
Examples 65
Other Resources 66
RUBY 66
Supported Metacharacters 67
Object-Oriented Interface 70
Unicode Support 75
Examples 75
JavaScript 77
Supported Metacharacters 77
Pattern-Matching Methods and Objects 79
Examples 82
Other Resources 83
vi | Contents
PCRE 83
Supported Metacharacters 84
PCRE API 89
Unicode Support 92
Examples 92
Other Resources 96
Apache Web Server 96
Supported Metacharacters 96
RewriteRule 99
Matching Directives 102
Examples 102
vi Editor 103
Supported Metacharacters 103
Pattern Matching 106
Examples 108
Other Resources 108
Shell Tools 109
Supported Metacharacters 109
Other Resources 114
Index 115
Contents | vii
Regular Expression Pocket
Reference
1
Conventions Used in This Book
The following typographical conventions are used in this
book:
Italic
Used for emphasis, new terms, program names, and
URLs
Constant width
Used for options, values, code fragments, and any text
that should be typed literally
Constant width italic
Used for text that should be replaced with user-supplied
values
Constant width bold
Used in examples for commands or other text that
should be typed literally by the user
Acknowledgments
Jeffrey E. F. Friedl’s Mastering Regular Expressions (O’Reilly)
is the definitive work on regular expressions. While writing, I
relied heavily on his book and his advice. As a convenience,
this book provides page references to Mastering Regular
Expressions, Third Edition (MRE) for expanded discussion of
regular expression syntax and concepts.
Nat Torkington and Linda Mui were excellent editors who
guided me through what turned out to be a tricky first edi-
tion. This edition was aided by the excellent editorial skills of
Andy Oram. Sarah Burcham deserves special thanks for
giving me the opportunity to write this book, and for her
contributions to the “Shell Tools” section. More thanks for
the input and technical reviews from Jeffrey Friedl, Philip
Hazel, Steve Friedl, Ola Bini, Ian Darwin, Zak Greant, Ron
Hitchens, A.M. Kuchling, Tim Allwine, Schuyler Erle, David
Lents, Rabble, Rich Bowan, Eric Eisenhart, and Brad Merrill.
Character representations
Many implementations provide shortcuts to represent char-
acters that may be difficult to input. (See MRE 115–118.)
Character shorthands
Most implementations have specific shorthands for the
alert, backspace, escape character, form feed, newline,
carriage return, horizontal tab, and vertical tab
characters. For example, \n is often a shorthand for the
newline character, which is usually LF (012 octal), but
can sometimes be CR (015 octal), depending on the oper-
ating system. Confusingly, many implementations use \b
to mean both backspace and word boundary (position
between a “word” character and a nonword character).
For these implementations, \b means backspace in a char-
acter class (a set of possible characters to match in the
string), and word boundary elsewhere.
Octal escape: \num
Represents a character corresponding to a two- or three-
digit octal number. For example, \015\012 matches an
ASCII CR/LF sequence.
Hex and Unicode escapes: \xnum, \x{num}, \unum, \Unum
Represent characters corresponding to hexadecimal num-
bers. Four-digit and larger hex numbers can represent the
range of Unicode characters. For example, \x0D\x0A
matches an ASCII CR/LF sequence.
Control characters: \cchar
Corresponds to ASCII control characters encoded with
values less than 32. To be safe, always use an uppercase
char—some implementations do not handle lowercase
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com