Szczegóły ebooka

Mastering Python Regular Expressions. For Python developers, this concise and down-to-earth guide to regular expressions

Mastering Python Regular Expressions. For Python developers, this concise and down-to-earth guide to regular expressions

Victor Romero, Felix L Luis

Ebook
Regular expressions are used by many text editors, utilities, and programming languages to search and manipulate text based on patterns. They are considered the Swiss army knife of text processing. Powerful search, replacement, extraction and validation of strings, repetitive and complex tasks are reduced to a simple pattern using regular expressions.


Mastering Python Regular Expressions will teach you about Regular Expressions, starting from the basics, irrespective of the language being used, and then it will show you how to use them in Python. You will learn the finer details of what Python supports and how to do it, and the differences between Python 2.x and Python 3.x.


The book starts with a general review of the theory behind the regular expressions to follow with an overview of the Python regex module implementation, and then moves on to advanced topics like grouping, looking around, and performance.


You will explore how to leverage Regular Expressions in Python, some advanced aspects of Regular Expressions and also how to measure and improve their performance. You will get a better understanding of the working of alternators and quantifiers. Also, you will comprehend the importance of grouping before finally moving on to performance optimization techniques like the RegexBuddy Tool and Backtracking.


Mastering Python Regular Expressions provides all the information essential for a better understanding of Regular Expressions in Python.
  • Mastering Python Regular Expressions
    • Table of Contents
    • Mastering Python Regular Expressions
    • Credits
    • About the Authors
    • About the Reviewers
    • www.PacktPub.com
      • Support files, eBooks, discount offers and more
        • Why Subscribe?
        • Free Access for Packt account holders
    • Preface
      • What this book covers
      • What you need for this book
      • Who this book is for
      • Conventions
      • Reader feedback
      • Customer support
        • Downloading the example code
        • Errata
        • Piracy
        • Questions
    • 1. Introducing Regular Expressions
      • History, relevance, and purpose
      • The regular expression syntax
        • Literals
        • Character classes
        • Predefined character classes
        • Alternation
        • Quantifiers
          • Greedy and reluctant quantifiers
        • Boundary Matchers
      • Summary
    • 2. Regular Expressions with Python
      • A brief introduction
      • Backslash in string literals
        • String Python 2.x
      • Building blocks for Python regex
        • RegexObject
          • Searching
            • match(string[, pos[, endpos]])
            • search(string[, pos[, endpos]])
            • findall(string[, pos[, endpos]])
            • finditer(string[, pos[, endpos]])
          • Modifying a string
            • split(string, maxsplit=0)
            • sub(repl, string, count=0)
            • subn(repl, string, count=0)
        • MatchObject
          • group([group1, ])
          • groups([default])
          • groupdict([default])
          • start([group])
          • end([group])
          • span([group])
          • expand(template)
        • Module operations
          • escape()
          • purge()
      • Compilation flags
        • re.IGNORECASE or re.I
        • re.MULTILINE or re.M
        • re.DOTALL or re.S
        • re.LOCALE or re.L
        • re.UNICODE or re.U
        • re.VERBOSE or re.X
        • re.DEBUG
      • Python and regex special considerations
        • Differences between Python and other flavors
        • Unicode
        • Whats new in Python 3
      • Summary
    • 3. Grouping
      • Introduction
      • Backreferences
      • Named groups
      • Non-capturing groups
        • Atomic groups
      • Special cases with groups
        • Flags per group
        • yes-pattern|no-pattern
      • Overlapping groups
      • Summary
    • 4. Look Around
      • Look ahead
        • Negative look ahead
      • Look around and substitutions
      • Look behind
        • Negative look behind
      • Look around and groups
      • Summary
    • 5. Performance of Regular Expressions
      • Benchmarking regular expressions with Python
      • The RegexBuddy tool
      • Understanding the Python regex engine
        • Backtracking
      • Optimization recommendations
        • Reuse compiled patterns
        • Extract common parts in alternation
        • Shortcut to alternation
        • Use non-capturing groups when appropriate
        • Be specific
        • Don't be greedy
      • Summary
    • Index
  • Tytuł: Mastering Python Regular Expressions. For Python developers, this concise and down-to-earth guide to regular expressions
  • Autor: Victor Romero, Felix L Luis
  • Tytuł oryginału: Mastering Python Regular Expressions. For Python developers, this concise and down-to-earth guide to regular expressions
  • ISBN: 9781783283163, 9781783283163
  • Data wydania: 2014-02-21
  • Format: Ebook
  • Identyfikator pozycji: e_3c9a
  • Wydawca: Packt Publishing