Introducing Regular Expressions_ Unraveling Regular Expressions, Step-by-Step [Fitzgerald 2012-08-03].pdf
(
12024 KB
)
Pobierz
Introducing Regular Expressions
Michael Fitzgerald
Beijing
Cambridge
Farnham
Köln
Sebastopol
Tokyo
•
•
•
•
•
Introducing Regular Expressions
by Michael Fitzgerald
Copyright © 2012 Michael Fitzgerald. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (
http://my.safaribooksonline.com
)
. For more information, contact our
corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com
.
Editor:
Simon St. Laurent
Production Editor:
Holly Bauer
Proofreader:
Julie Van Keuren
Indexer:
Lucie Haskins
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
July 2012:
First Edition.
Revision History for the First Edition:
2012-07-10 First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449392680
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc.
Introducing Regular Expressions
, the image of a fruit bat, 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.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-39268-0
[LSI]
1341860829
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1.
What Is a Regular Expression? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Getting Started with Regexpal
2
Matching a North American Phone Number
2
Matching Digits with a Character Class
4
Using a Character Shorthand
5
Matching Any Character
5
Capturing Groups and Back References
6
Using Quantifiers
6
Quoting Literals
8
A Sample of Applications
9
What You Learned in Chapter 1
11
Technical Notes
11
2.
Simple Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Matching String Literals
15
Matching Digits
15
Matching Non-Digits
17
Matching Word and Non-Word Characters
18
Matching Whitespace
20
Matching Any Character, Once Again
22
Marking Up the Text
24
Using
sed
to Mark Up Text
24
Using Perl to Mark Up Text
25
What You Learned in Chapter 2
27
Technical Notes
27
3.
Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The Beginning and End of a Line
29
Word and Non-word Boundaries
31
iii
Plik z chomika:
musli_com
Inne pliki z tego folderu:
Beginning Regular Expressions [Watt 2005-02-04].pdf
(24823 KB)
Introducing Regular Expressions_ Unraveling Regular Expressions, Step-by-Step [Fitzgerald 2012-08-03].pdf
(12024 KB)
Regular Expressions Cookbook_ Detailed Solutions in Eight Programming Languages (2nd ed.) [Goyvaerts & Levithan 2012-09-06].pdf
(11484 KB)
Mastering Regular Expressions_ Powerful Techniques for Perl and Other Tools (2nd ed.) [Friedl 2002-07-15].pdf
(6308 KB)
Introduction to Regular Expressions in SAS [Windham 2014-11-18].pdf
(3047 KB)
Inne foldery tego chomika:
3D Design - Programming
ActionScript
Actionscript - Flash - Flex - Air
Ada
ADO
Zgłoś jeśli
naruszono regulamin