Books & Videos

Table of Contents

  1. Chapter 1 Introduction to Regular Expressions

    1. Regular Expressions Defined

    2. Searching and Replacing with Regular Expressions

    3. Tools for Working with Regular Expressions

  2. Chapter 2 Basic Regular Expression Skills

    1. Match Literal Text

    2. Match Nonprintable Characters

    3. Match One of Many Characters

    4. Match Any Character

    5. Match Something at the Start and/or the End of a Line

    6. Match Whole Words

    7. Unicode Code Points, Properties, Blocks, and Scripts

    8. Match One of Several Alternatives

    9. Group and Capture Parts of the Match

    10. Match Previously Matched Text Again

    11. Capture and Name Parts of the Match

    12. Repeat Part of the Regex a Certain Number of Times

    13. Choose Minimal or Maximal Repetition

    14. Eliminate Needless Backtracking

    15. Prevent Runaway Repetition

    16. Test for a Match Without Adding It to the Overall Match

    17. Match One of Two Alternatives Based on a Condition

    18. Add Comments to a Regular Expression

    19. Insert Literal Text into the Replacement Text

    20. Insert the Regex Match into the Replacement Text

    21. Insert Part of the Regex Match into the Replacement Text

    22. Insert Match Context into the Replacement Text

  3. Chapter 3 Programming with Regular Expressions

    1. Programming Languages and Regex Flavors

    2. Literal Regular Expressions in Source Code

    3. Import the Regular Expression Library

    4. Creating Regular Expression Objects

    5. Setting Regular Expression Options

    6. Test Whether a Match Can Be Found Within a Subject String

    7. Test Whether a Regex Matches the Subject String Entirely

    8. Retrieve the Matched Text

    9. Determine the Position and Length of the Match

    10. Retrieve Part of the Matched Text

    11. Retrieve a List of All Matches

    12. Iterate over All Matches

    13. Validate Matches in Procedural Code

    14. Find a Match Within Another Match

    15. Replace All Matches

    16. Replace Matches Reusing Parts of the Match

    17. Replace Matches with Replacements Generated in Code

    18. Replace All Matches Within the Matches of Another Regex

    19. Replace All Matches Between the Matches of Another Regex

    20. Split a String

    21. Split a String, Keeping the Regex Matches

    22. Search Line by Line

  4. Chapter 4 Validation and Formatting

    1. Validate Email Addresses

    2. Validate and Format North American Phone Numbers

    3. Validate International Phone Numbers

    4. Validate Traditional Date Formats

    5. Accurately Validate Traditional Date Formats

    6. Validate Traditional Time Formats

    7. Validate ISO 8601 Dates and Times

    8. Limit Input to Alphanumeric Characters

    9. Limit the Length of Text

    10. Limit the Number of Lines in Text

    11. Validate Affirmative Responses

    12. Validate Social Security Numbers

    13. Validate ISBNs

    14. Validate ZIP Codes

    15. Validate Canadian Postal Codes

    16. Validate U.K. Postcodes

    17. Find Addresses with Post Office Boxes

    18. Reformat Names From “FirstName LastName” to “LastName, FirstName”

    19. Validate Credit Card Numbers

    20. European VAT Numbers

  5. Chapter 5 Words, Lines, and Special Characters

    1. Find a Specific Word

    2. Find Any of Multiple Words

    3. Find Similar Words

    4. Find All Except a Specific Word

    5. Find Any Word Not Followed by a Specific Word

    6. Find Any Word Not Preceded by a Specific Word

    7. Find Words Near Each Other

    8. Find Repeated Words

    9. Remove Duplicate Lines

    10. Match Complete Lines That Contain a Word

    11. Match Complete Lines That Do Not Contain a Word

    12. Trim Leading and Trailing Whitespace

    13. Replace Repeated Whitespace with a Single Space

    14. Escape Regular Expression Metacharacters

  6. Chapter 6 Numbers

    1. Integer Numbers

    2. Hexadecimal Numbers

    3. Binary Numbers

    4. Strip Leading Zeros

    5. Numbers Within a Certain Range

    6. Hexadecimal Numbers Within a Certain Range

    7. Floating Point Numbers

    8. Numbers with Thousand Separators

    9. Roman Numerals

  7. Chapter 7 URLs, Paths, and Internet Addresses

    1. Validating URLs

    2. Finding URLs Within Full Text

    3. Finding Quoted URLs in Full Text

    4. Finding URLs with Parentheses in Full Text

    5. Turn URLs into Links

    6. Validating URNs

    7. Validating Generic URLs

    8. Extracting the Scheme from a URL

    9. Extracting the User from a URL

    10. Extracting the Host from a URL

    11. Extracting the Port from a URL

    12. Extracting the Path from a URL

    13. Extracting the Query from a URL

    14. Extracting the Fragment from a URL

    15. Validating Domain Names

    16. Matching IPv4 Addresses

    17. Matching IPv6 Addresses

    18. Validate Windows Paths

    19. Split Windows Paths into Their Parts

    20. Extract the Drive Letter from a Windows Path

    21. Extract the Server and Share from a UNC Path

    22. Extract the Folder from a Windows Path

    23. Extract the Filename from a Windows Path

    24. Extract the File Extension from a Windows Path

    25. Strip Invalid Characters from Filenames

  8. Chapter 8 Markup and Data Interchange

    1. Find XML-Style Tags

    2. Replace <b> Tags with <strong>

    3. Remove All XML-Style Tags Except <em> and <strong>

    4. Match XML Names

    5. Convert Plain Text to HTML by Adding <p> and <br> Tags

    6. Find a Specific Attribute in XML-Style Tags

    7. Add a cellspacing Attribute to <table> Tags That Do Not Already Include It

    8. Remove XML-Style Comments

    9. Find Words Within XML-Style Comments

    10. Change the Delimiter Used in CSV Files

    11. Extract CSV Fields from a Specific Column

    12. Match INI Section Headers

    13. Match INI Section Blocks

    14. Match INI Name-Value Pairs

  1. Colophon