Buying options Buying options

Authorized Marketplace Sellers:
1 new from $39.95

Mastering Regular Expressions

Friedl, Jeffrey E. F.
ISBN-10: 0596002890
ISBN-13: 9780596002893

In our Marketplace:
1 new from $39.95
Jeffrey E. F. Friedl was raised in the countryside of Rootstown, Ohio, and had aspirations of being an astronomer until one day noticing a TRS-80 Model I sitting unused in the corner of the chem lab (bristling with a full 16K of RAM, no less). He eventually began using Unix (and regular expressions) in 1980, and earned degrees in Computer Science from Kent (BS) and the University of New Hampshire (MS). He did kernel development for Omron Corporation in Kyoto, Japan for eight years before moving in 1997 to Silicon Valley to apply his regular-expression know-how to financial news and data for a little-known company called "Yahoo!". When faced with the daunting task of filling his copious free time, Jeffrey enjoys playing Ultimate Frisbee and basketball with friends at Yahoo!, programming his house, and feeding the squirrels and jays in his back yard. He also enjoys spending time with his wife Fumie, and preparing for the Fall 2002 release of their first "software project" together.Regular expressions are an extremely powerful tool for manipulating text and data. They have spread like wildfire in recent years, and are now offered as standard features in Perl, Java, VB.NET and C# (and any language using the .NET Framework), PHP, Python, Ruby, Tcl, MySQL, awk, Emacs, and many other popular tools and languages. If you don't use regular expressions yet, you will discover in this book a whole new world of mastery over your data. If you already use them, you'll appreciate this book's unprecedented detail and breadth of coverage. If you think you know all you need to know about regular expressions, this book is a stunning eye-opener. Despite their wide availability, flexibility, and unparalleled power, regular expressions are frequently underutilized. Regular expressions allow you to code complex and subtle text processing that you never imagined could be automated. Regular expressions can save you time and aggravation. They can be used to craft elegant solutions to a wide range of problems. A command of regular expressions is an invaluable skill. Yet what is power in the hands of an expert can be fraught with peril for the unwary. Mastering Regular Expressions will help you navigate the minefield to becoming an expert. Once you've mastered regular expressions, they'll become an invaluable part of your toolkit. You will wonder how you ever got by without them. Mastering Regular Expressions, Second Edition, has been thoroughly updated to include all the new features of Perl 5.8 as well as several other languages, including Java, VB.NET, C#, Python, JavaScript, Tcl, and Ruby. Written in the lucid, entertaining tone that makes a complex, dry topic crystal-clear to thousands of programmers, and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions offers a wealth of information that you can put to immediate use. Topics include: * A comparison of features among different versions of many languages and tools * How the regular expression engine works * Optimization (major savings available here!) * Matching just what you want, but not what you don't want * Sections and chapters on individual languages.This volume has been updated to include all the new Perl features, as well as several other languages, including Java, VB. NET, C#, Python, JavaScript, Tcl, and Ruby. It offers solutions to complex real-world problems and features information that can be put to immediate use.A tutorial and reference to using the technique of regular expressions to facilitate the handling of text and data in Perl and other scripting languages, editors such as Emacs and programming environments including Delphi and Visual C++, and specialized tools such as and Expect. This workbook assumes the reader has experience on a computer but no programming knowledge.Written by an expert in the topic, this book shows programmers not only how to use, but how to think in regular expressions. In addition, the second edition explains how to use regular expressions to code complex and subtle text processing that you never imagined could be automated. Included are such key topics as avoiding common errors and optimizing expressions. The book covers many features added to Perl-a language well endowed with regular expressions as well as other languages such as Java, Python, and Visual Basic that include support for this powerful tool.Regular expressions are an extremely powerful tool for manipulating text and data. They are now standard features in a wide range of languages and popular tools, including Perl, Java, VB.NET and C# (and any language using the .NET Framework), PHP, Python, Ruby, Tcl, MySQL, awk, and Emacs. If you don't use regular expressions yet, you will discover in this book a whole new world of mastery over your data. If you already use them, you'll appreciate this book's unprecedented detail and breadth of coverage.
Prefacep. xv
Introduction to Regular Expressionsp. 1
Solving Real Problemsp. 2
Regular Expressions as a Languagep. 4
The Filename Analogyp. 4
The Language Analogyp. 5
The Regular-Expression Frame of Mindp. 6
If You Have Some Regular-Expression Experiencep. 6
Searching Text Files: Egrepp. 6
Egrep Metacharactersp. 8
Start and End of the Linep. 8
Character Classesp. 9
Matching Any Character with Dotp. 11
Alternationp. 13
Ignoring Differences in Capitalizationp. 14
Word Boundariesp. 15
In a Nutshellp. 16
Optional Itemsp. 17
Other Quantifiers: Repetitionp. 18
Parentheses and Backreferencesp. 20
The Great Escapep. 22
Expanding the Foundationp. 23
Linguistic Diversificationp. 23
The Goal of a Regular Expressionp. 23
A Few More Examplesp. 23
Regular Expression Nomenclaturep. 27
Improving on the Status Quop. 30
Summaryp. 32
Personal Glimpsesp. 33
Extended Introductory Examplesp. 35
About the Examplesp. 36
A Short Introduction to Perlp. 37
Matching Text with Regular Expressionsp. 38
Toward a More Real-World Examplep. 40
Side Effects of a Successful Matchp. 40
Intertwined Regular Expressionsp. 43
Intermissionp. 49
Modifying Text with Regular Expressionsp. 50
Example: Form Letterp. 50
Example: Prettifying a Stock Pricep. 51
Automated Editingp. 53
A Small Mail Utilityp. 53
Adding Commas to a Number with Lookaroundp. 59
Text-to-HTML Conversionp. 67
That Doubled-Word Thingp. 77
Overview of Regular Expression Features and Flavorsp. 83
A Casual Stroll Across the Regex Landscapep. 85
The Origins of Regular Expressionsp. 85
At a Glancep. 91
Care and Handling of Regular Expressionsp. 93
Integrated Handlingp. 94
Procedural and Object-Oriented Handlingp. 95
A Search-and-Replace Examplep. 97
Search and Replace in Other Languagesp. 99
Care and Handling: Summaryp. 101
Strings, Character Encodings, and Modesp. 101
Strings as Regular Expressionsp. 101
Character-Encoding Issuesp. 105
Regex Modes and Match Modesp. 109
Common Metacharacters and Featuresp. 112
Character Representationsp. 114
Character Classes and Class-Like Constructsp. 117
Anchors and Other "Zero-Width Assertions"p. 127
Comments and Mode Modifiersp. 133
Grouping, Capturing, Conditionals, and Controlp. 135
Guide to the Advanced Chaptersp. 141
The Mechanics of Expression Processingp. 143
Start Your Engines!p. 143
Two Kinds of Enginesp. 144
New Standardsp. 144
Regex Engine Typesp. 145
From the Department of Redundancy Departmentp. 146
Testing the Engine Typep. 146
Match Basicsp. 147
About the Examplesp. 147
The Match That Begins Earliest Winsp. 148
Engine Pieces and Partsp. 149
The Standard Quantifiers Are Greedyp. 151
Regex-Directed Versus Text-Directedp. 153
NFA Engine: Regex-Directedp. 153
DFA Engine: Text-Directedp. 155
First Thoughts: NFA and DFA in Comparisonp. 156
Backtrackingp. 157
A Really Crummy Analogyp. 158
Two Important Points on Backtrackingp. 159
Saved Statesp. 159
Backtracking and Greedinessp. 162
More About Greediness and Backtrackingp. 163
Problems of Greedinessp. 164
Multi-Character "Quotes"p. 165
Using Lazy Quantifiersp. 166
Greediness and Laziness Always Favor a Matchp. 167
The Essence of Greediness, Laziness, and Backtrackingp. 168
Possessive Quantifiers and Atomic Groupingp. 169
Possessive Quantifiers, ?+, *+, ++, and {m,n}+p. 172
The Backtracking of Lookaroundp. 173
Is Alternation Greedy?p. 174
Taking Advantage of Ordered Alternationp. 175
NFA, DFA, and POSIXp. 177
"The Longest-Leftmost"p. 177
POSIX and the Longest-Leftmost Rulep. 178
Speed and Efficiencyp. 179
Summary: NFA and DFA in Comparisonp. 180
Summaryp. 183
Practical Regex Techniquesp. 185
Regex Balancing Actp. 186
A Few Short Examplesp. 186
Continuing with Continuation Linesp. 186
Matching an IP Addressp. 187
Working with Filenamesp. 190
Matching Balanced Sets of Parenthesesp. 193
Watching Out for Unwanted Matchesp. 194
Matching Delimited Textp. 196
Knowing Your Data and Making Assumptionsp. 198
Stripping Leading and Trailing Whitespacep. 199
HTML-Related Examplesp. 200
Matching an HTML Tagp. 200
Matching an HTML Linkp. 201
Examining an HTTP URLp. 203
Validating a Hostnamep. 203
Plucking Out a URL in the Real Worldp. 205
Extended Examplesp. 208
Keeping in Sync with Your Datap. 208
Parsing CSV Filesp. 212
Crafting an Efficient Expressionp. 221
A Sobering Examplep. 222
A Simple Change--Placing Your Best Foot Forwardp. 223
Efficiency Verses Correctnessp. 223
Advancing Further--Localizing the Greedinessp. 225
Reality Checkp. 226
A Global View of Backtrackingp. 228
More Work for a POSIX NFAp. 229
Work Required During a Non-Matchp. 230
Being More Specificp. 231
Alternation Can Be Expensivep. 231
Benchmarkingp. 232
Know What You're Measuringp. 234
Benchmarking with Javap. 234
Benchmarking with VB.NETp. 236
Benchmarking with Pythonp. 237
Benchmarking with Rubyp. 238
Benchmarking with Tclp. 239
Common Optimizationsp. 239
No Free Lunchp. 240
Everyone's Lunch is Differentp. 240
The Mechanics of Regex Applicationp. 241
Pre-Application Optimizationsp. 242
Optimizations with the Transmissionp. 245
Optimizations of the Regex Itselfp. 247
Techniques for Faster Expressionsp. 252
Common Sense Techniquesp. 254
Expose Literal Textp. 255
Expose Anchorsp. 255
Lazy Versus Greedy: Be Specificp. 256
Split Into Multiple Regular Expressionsp. 257
Mimic Initial-Character Discriminationp. 258
Use Atomic Grouping and Possessive Quantifiersp. 259
Lead the Engine to a Matchp. 260
Unrolling the Loopp. 261
Building a Regex From Past Experiencesp. 262
The Real "Unrolling-the-Loop" Patternp. 263
A Top-Down Viewp. 266
An Internet Hostnamep. 267
Observationsp. 268
Using Atomic Grouping and Possessive Quantifiersp. 268
Short Unrolling Examplesp. 270
Unrolling C Commentsp. 272
The Freeflowing Regexp. 277
A Helping Hand to Guide the Matchp. 277
A Well-Guided Regex is a Fast Regexp. 279
Wrapupp. 280
In Summary: Think!p. 281
Perlp. 283
Regular Expressions as a Language Componentp. 285
Perl's Greatest Strengthp. 286
Perl's Greatest Weaknessp. 286
Perl's Regex Flavorp. 286
Regex Operands and Regex Literalsp. 288
How Regex Literals Are Parsedp. 292
Regex Modifiersp. 292
Regex-Related Perlismsp. 293
Expression Contextp. 294
Dynamic Scope and Regex Match Effectsp. 295
Special Variables Modified by a Matchp. 299
The qr/.../ Operator and Regex Objectsp. 303
Building and Using Regex Objectsp. 303
Viewing Regex Objectsp. 305
Using Regex Objects for Efficiencyp. 306
The Match Operatorp. 306
Match's Regex Operandp. 307
Specifying the Match Target Operandp. 308
Different Uses of the Match Operatorp. 309
Iterative Matching: Scalar Context, with /gp. 312
The Match Operator's Environmental Relationsp. 316
The Substitution Operatorp. 318
The Replacement Operandp. 319
The /e Modifierp. 319
Context and Return Valuep. 321
The Split Operatorp. 321
Basic Splitp. 322
Returning Empty Elementsp. 324
Split's Special Regex Operandsp. 325
Split's Match Operand with Capturing Parenthesesp. 326
Fun with Perl Enhancementsp. 326
Using a Dynamic Regex to Match Nested Pairsp. 328
Using the Embedded-Code Constructp. 331
Using local in an Embedded-Code Constructp. 335
A Warning About Embedded Code and my Variablesp. 338
Matching Nested Constructs with Embedded Codep. 340
Overloading Regex Literalsp. 341
Problems with Regex-Literal Overloadingp. 344
Mimicking Named Capturep. 344
Perl Efficiency Issuesp. 347
"There's More Than One Way to Do It"p. 348
Regex Compilation, the /o Modifier, qr/.../, and Efficiencyp. 348
Understanding the "Pre-Match" Copyp. 355
The Study Functionp. 359
Benchmarkingp. 360
Regex Debugging Informationp. 361
Final Commentsp. 363
Javap. 365
Judging a Regex Packagep. 366
Technical Issuesp. 366
Social and Political Issuesp. 367
Object Modelsp. 368
A Few Abstract Object Modelsp. 368
Growing Complexityp. 372
Packages, Packages, Packagesp. 372
Why So Many "Perl5" Flavors?p. 375
Lies, Damn Lies, and Benchmarksp. 375
Recommendationsp. 377
Sun's Regex Packagep. 378
Regex Flavorp. 378
Using java.util.regexp. 381
The Pattern.compile() Factoryp. 383
The Matcher Objectp. 384
Other Pattern Methodsp. 390
A Quick Look at Jakarta-OROp. 392
ORO's Perl5Utilp. 392
A Mini Perl5Util Referencep. 393
Using ORO's Underlying Classesp. 397
.NETp. 399
.NET's Regex Flavorp. 400
Additional Comments on the Flavorp. 402
Using .NET Regular Expressionsp. 407
Regex Quickstartp. 407
Package Overviewp. 409
Core Object Overviewp. 410
Core Object Detailsp. 412
Creating Regex Objectsp. 413
Using Regex Objectsp. 415
Using Match Objectsp. 421
Using Group Objectsp. 424
Static "Convenience" Functionsp. 425
Regex Cachingp. 426
Support Functionsp. 426
Advanced .NETp. 427
Regex Assembliesp. 428
Matching Nested Constructsp. 430
Capture Objectsp. 431
Indexp. 433
Table of Contents provided by Syndetics. All Rights Reserved.

List price: $39.95
Edition: 2nd 2002
Publisher: O'Reilly Media, Incorporated
Binding: Trade Paper
Pages: 484
Size: 7.00" wide x 9.25" long x 1.50" tall
Weight: 1.69 lbs.
Language: English

100% Money Back Guarantee: Wrong item? No problem! Our hassle-free returns policy has you covered. We'll also process your order within 24 hours. Learn more about our shipping policy.


About TextbooksRus.com

TextbooksRus.com is dedicated to providing customers with the lowest prices on textbooks, trade books and professional books. In addition to low prices, TextbooksRus.com offers a buyback system that is unparalleled by competitors.
© 2002-2010, TextbooksRus.com