Mastering Regular Expressions
Home > Computing and Information Technology > Computer science > Mastering Regular Expressions
Mastering Regular Expressions

Mastering Regular Expressions


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

Regular expressions are a powerful tool for manipulating text and data. If you don't use them 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. With regular expressions, you can save yourself time and aggravation while dealing with documents, mail messages, log files -- you name it -- any type of text or data. For example, regular expressions can play a vital role in constructing a World Wide Web CGI script, which can involve text and data of all sorts. Regular expressions are not a tool in and of themselves, but are included as part of a larger utility. The classic example is grep. These days, regular expressions can be found everywhere, such as in: Scripting languages (including Perl, Tcl, awk, and Python) Editors (including Emacs, vi, and Nisus Writer) Programming environments (including Delphi and Visual C++) Specialized tools (including lex, Expect, and sed) While many of these tools originated on UNIX, they are now available for a wide variety of platforms, including DOS/Windows and MacOS, so you can use them in your home environment. Additionally, many favorite programming languages offer regular-expression libraries, so you can include support for them in your own programs, and yes, even applets. There can be certain subtle, but valuable, ways to think when you're using regular expressions, and these can be taught. Jeffrey Friedl has spent years helping people on the Net understand and use regular expressions. In this book he leads you through the steps of knowing exactly how to craft a regular expression to get the job done. Regular expressions are not used in a vacuum. In this book, a variety of tools are examined and used in an extensive array of examples, with a major focus on Perl. Perl is extremely well endowed with rich and expressive regular expressions. Yet what is power in the hands of an expert can be fraught with peril for the unwary. This book will help you navigate the minefield to becoming an expert.

Table of Contents:
Preface. Why I Wrote This Book. Intended Audience. How to Read This Book. This Book, as a Story. This Book, as a Reference. Organization. The Introduction. The Details. Tool-Specific Information. Typographical Conventions. Exercises. Personal Comments and Acknowledgments. Shoulders to Stand On. Other Thanks In the Future. Chapter 1. Introduction to Regular Expressions Solving Real Problems Regular Expressions as a Language The Filename Analogy The Language Analogy The Regular-Expression Frame of Mind Searching Text Files: Egrep Egrep Metacharacters Start and End of the Line Character Classes Matching Any Character -- Dot Alternation Word Boundaries In a Nutshell Optional Items Other Quantifiers: Repetition Ignoring Differences in Capitalization Parentheses and Backreferences The Great Escape Expanding the Foundation Linguistic Diversification The Goal of a Regular Expression A Few More Examples Regular Expression Nomenclature Improving on the Status Quo Summary Personal Glimpses. Chapter 2. Extended Introductory Examples About the Examples A Short Introduction to Perl Matching Text with Regular Expressions Toward a More Real-World Example Side Effects of a Successful Match Intertwined Regular Expressions Intermission Modifying Text with Regular Expressions Automated Editing A Small Mail Utility That Doubled-Word Thing. Chapter 3. Overview of Regular Expression Features and Flavors A Casual Stroll Across the Regex Landscape The World According to Grep The Times They Are a'\|Changin' At a Glance POSIX Care and Handling of Regular Expressions Identifying a Regex Doing Something with the Matched Text Other Examples Care and Handling: Summary Engines and Chrome Finish Chrome and Appearances Engines and Drivers Common Metacharacters Character Shorthands Strings as Regular Expressions Class Shorthands, Dot, and Character Classes Anchoring Grouping and Retrieving Quantifiers Alternation Guide to the Advanced Chapters Tool-Specific Information. Chapter 4. The Mechanics of Expression Processing Start Your Engines! Two Kinds of Engines New Standards Regex Engine Types From the Department of Redundancy Department Match Basics About the Examples Rule 1: The Earliest Match Wins The ``Transmission'' and the Bump-Along Engine Pieces and Parts Rule 2: Some Metacharacters Are Greedy Regex-Directed vs. Text-Directed NFA Engine: Regex-Directed DFA Engine: Text-Directed The Mysteries of Life Revealed Backtracking A Really Crummy Analogy Two Important Points on Backtracking Saved States Backtracking and Greediness More About Greediness Problems of Greediness Multi-Character ``Quotes'' Laziness? Greediness Always Favors a Match. Is Alternation Greedy? Uses for Non-Greedy Alternation Greedy Alternation in Perspective Character Classes vs. Alternation NFA\, DFA\, and POSIX ``The Longest-Leftmost'' POSIX and the Longest-Leftmost Rule Speed and Efficiency DFA and NFA in Comparison Practical Regex Techniques Contributing Factors Be Specific Difficulties and Impossibilities Watching Out for Unwanted Matches Matching Delimited Text Knowing Your Data and Making Assumptions Additional Greedy Examples Summary Match Mechanics Summary Some Practical Effects of Match Mechanics. Chapter 5. Crafting a Regular Expression A Sobering Example A Simple Change -- Placing Your Best Foot Forward More Advanced -- Localizing the Greediness Reality Check A Global View of Backtracking More Work for a POSIX NFA Work Required During a Non-Match Being More Specific Alternation Can Be Expensive A Strong Lead The Impact of Parentheses Internal Optimizations First-Character Discrimination Fixed-String Check Simple Repetition Needless Small Quantifiers Length Cognizance Match Cognizance Need Cognizance String/Line Anchors Compile Caching Testing the Engine Type Basic NFA vs. DFA Testing Traditional NFA vs. POSIX NFA Testing Unrolling the Loop Method 1: Building a Regex From Past Experiences The Real ``Unrolling the Loop'' Pattern Method 2: A Top-Down View Method 3: A Quoted Internet Hostname Observations Unrolling C Comments Regex Headaches A Na\(:ive View Unrolling the C Loop The Freeflowing Regex A Helping Hand to Guide the Match A Well-Guided Regex is a Fast Regex Wrapup Think! The Many Twists and Turns of Optimizations. Chapter 6. Tool-Specific Information Questions You Should Be Asking Something as Simple as Grep... In This Chapter Awk Differences Among Awk Regex Flavors Awk Regex Functions and Operators Tcl Tcl Regex Operands Using Tcl Regular Expressions Tcl Regex Optimizations GNU Emacs Emacs Strings as Regular Expressions Emacs's Regex Flavor Emacs Match Results Benchmarking in Emacs Emacs Regex Optimizations. Chapter 7. Perl Regular Expressions The Perl Way Regular Expressions as a Language Component Perl's Greatest Strength Perl's Greatest Weakness A Chapter, a Chicken, and The Perl Way An Introductory Example: Parsing CSV Text Regular Expressions and The Perl Way Perl Unleashed Regex-Related Perlisms Expression Context Dynamic Scope and Regex Match Effects Special Variables Modified by a Match ``Doublequotish Processing'' and Variable Interpolation Perl's Regex Flavor Quantifiers -- Greedy and Lazy Grouping String Anchors Multi-Match Anchor Word Anchors Convenient Shorthands and Other Notations Character Classes Modification with \Q and Friends: True Lies The Match Operator Match-Operand Delimiters Match Modifiers Specifying the Match Target Operand Other Side Effects of the Match Operator Match Operator Return Value Outside Influences on the Match Operator The Substitution Operator The Replacement Operand The /e Modifier Context and Return Value Using /g with a Regex That Can Match Nothingness The Split Operator Basic Split Advanced Split Advanced Split's Match Operand Scalar-Context Split Split's Match Operand with Capturing Parentheses Perl Efficiency Issues ``There's More Than One Way to Do It'' Regex Compilation, the /o Modifier, and Efficiency Unsociable $ and Friends The Efficiency Penalty of the /i Modifier Substitution Efficiency Concerns Benchmarking Regex Debugging Information The Study Function Putting It All Together Stripping Leading and Trailing Whitespace Adding Commas to a Number Removing C Comments Matching an Email Address Final Comments Notes for Perl4 Appendix A. Online Information General Information Mastering Regular Expressions O'Reilly Associates OAK Archive's Virtual Software Library The GNU Archive Yahoo! Other Web Links Awk C Library Packages Egrep Emacs Flex Perl Python Tcl Appendix B. Email Regex Program

About the Author :
Jeffrey 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 RAM, no less). He eventually began using UNIX (and regular expressions) in 1980. With degrees in computer science from Kent (B.S.) and the University of New Hampshire (M.S.), he is now an engineer with Omron Corporation, Kyoto, Japan. He lives in Nagaokakyou-city with Tubby, his long-time friend and Teddy Bear, in a tiny apartment designed for a (Japanese) family of three. Jeffrey applies his regular-expression know-how to make the world a safer place for those not bilingual in English and Japanese. He built and maintains the World Wide Web Japanese-English dictionary server, http://www.itc.omron.com/cgi-bin/j-e, and is active in a variety of language-related projects, both in print and on the Web. When faced with the daunting task of filling his copious free time, Jeffrey enjoys riding through the mountainous countryside of Japan on his Honda CB-1. At the age of 30, he finally decided to put his 6'4" height to some use, and joined the Omron company basketball team. While finalizing the manuscript for Mastering Regular Expressions., he took time out to appear in his first game, scoring five points in nine minutes of play, which he feels is pretty darn good for a geek. When visiting his family in The States, Jeffrey enjoys dancing a two-step with his mom, binking old coins with his dad, and playing schoffkopf with his brothers and sisters.


Best Sellers


Product Details
  • ISBN-13: 9781565922570
  • Publisher: O'Reilly Media
  • Publisher Imprint: O'Reilly Media
  • Height: 233 mm
  • Returnable: N
  • Width: 178 mm
  • ISBN-10: 1565922573
  • Publisher Date: 04 Feb 1997
  • Binding: Book
  • Language: English
  • Weight: 600 gr


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Mastering Regular Expressions
O'Reilly Media -
Mastering Regular Expressions
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Mastering Regular Expressions

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!