Chapter 9 Extraction and Substitution with Regular Expressions

Now that we know what regular expressions are and how to define them, let’s look at how we actually use them to do something practical.

The use of regular expressions generally falls into two categories: matching (both to check whether a string matches a pattern and to extract matches from it) and substitution (replacing patterns with other text). Let’s look first at matching.

Get Text Processing with Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.