Regular Expression Pocket Reference, 2nd Edition

Book description

This handy little book offers programmers a complete overview of the syntax and semantics of regular expressions that are at the heart of every text-processing application. Ideal as a quick reference, Regular Expression Pocket Reference covers the regular expression APIs for Perl 5.8, Ruby (including some upcoming 1.9 features), Java, PHP, .NET and C#, Python, vi, JavaScript, and the PCRE regular expression libraries.

This concise and easy-to-use reference puts a very powerful tool for manipulating text and data right at your fingertips. Composed of a mixture of symbols and text, regular expressions can be an outlet for creativity, for brilliant programming, and for the elegant solution. Regular Expression Pocket Reference offers an introduction to regular expressions, pattern matching, metacharacters, modes and constructs, and then provides separate sections for each of the language APIs, with complete regex listings including:

  • Supported metacharacters for each language API
  • Regular expression classes and interfaces for Ruby, Java, .NET, and C#
  • Regular expression operators for Perl 5.8
  • Regular expression module objects and functions for Python
  • Pattern-matching functions for PHP and the vi editor
  • Pattern-matching methods and objects for JavaScript
  • Unicode Support for each of the languages
With plenty of examples and other resources, Regular Expression Pocket Reference summarizes the complex rules for performing this critical text-processing function, and presents this often-confusing topic in a friendly and well-organized format. This guide makes an ideal on-the-job companion.

Publisher resources

View/Submit Errata

Table of contents

  1. Regular Expression Pocket Reference
  2. 1. Regular Expression Pocket Reference
    1. About This Book
      1. Conventions Used in This Book
      2. Acknowledgments
    2. Introduction to Regexes and Pattern Matching
      1. Regex Metacharacters, Modes, and Constructs
        1. Character representations
        2. Character classes and class-like constructs
        3. Anchors and zero-width assertions
        4. Comments and mode modifiers
        5. Grouping, capturing, conditionals, and control
      2. Unicode Support
    3. Regular Expression Cookbook
      1. Recipes
        1. Removing leading and trailing whitespace
        2. Numbers from 0 to 999999
        3. Valid HTML Hex code
        4. U.S. Social Security number
        5. U.S. zip code
        6. U.S. currency
        7. Match date: MM/DD/YYYY HH:MM:SS
        8. Leading pathname
        9. Dotted Quad IP address
        10. MAC address
        11. Email
        12. HTTP URL
    4. Perl 5.8
      1. Supported Metacharacters
      2. Regular Expression Operators
        1. qr// (Quote Regex)
        2. m// (Matching)
        3. s/// (Substitution)
        4. split
      3. Unicode Support
      4. Examples
      5. Other Resources
    5. Java (java.util.regex)
      1. Supported Metacharacters
      2. Regular Expression Classes and Interfaces
        1. java.lang.String
        2. java.util.regex.Pattern
        3. java.util.regex.Matcher
        4. java.util.regex.PatternSyntaxException
        5. java.lang.CharSequence
      3. Unicode Support
      4. Examples
      5. Other Resources
    6. .NET and C#
      1. Supported Metacharacters
      2. Regular Expression Classes and Interfaces
        1. Regex
        2. Match
        3. Group
      3. Unicode Support
      4. Examples
      5. Other Resources
    7. PHP
      1. Supported Metacharacters
      2. Pattern-Matching Functions
      3. Examples
      4. Other Resources
    8. Python
      1. Supported Metacharacters
      2. re Module Objects and Functions
        1. Module Functions
        2. RegExp
        3. Match Objects
      3. Unicode Support
      4. Examples
      5. Other Resources
    9. RUBY
      1. Supported Metacharacters
      2. Object-Oriented Interface
        1. String
        2. Regexp
        3. MatchData
      3. Unicode Support
      4. Examples
    10. JavaScript
      1. Supported Metacharacters
      2. Pattern-Matching Methods and Objects
        1. String
        2. RegExp
      3. Examples
      4. Other Resources
    11. PCRE
      1. Supported Metacharacters
      2. PCRE API
        1. PCRE API Synopsis
      3. Unicode Support
      4. Examples
      5. Other Resources
    12. Apache Web Server
      1. Supported Metacharacters
      2. RewriteRule
      3. Matching Directives
      4. Examples
    13. vi Editor
      1. Supported Metacharacters
      2. Pattern Matching
        1. Searching
        2. Substitution
      3. Examples
      4. Other Resources
    14. Shell Tools
      1. Supported Metacharacters
        1. egrep
        2. sed
        3. awk
      2. Other Resources
  3. Index
  4. About the Author
  5. Copyright

Product information

  • Title: Regular Expression Pocket Reference, 2nd Edition
  • Author(s): Tony Stubblebine
  • Release date: July 2007
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449338930