(This article was originally published at Three-Toed Sloth , and syndicated at StatsBlogs.)

Lectures
20 and 21: Regular expressions. Why we need ways of describing patterns of
strings, and not just specific strings. The syntax and semantics of regular
expressions: constants, concatenation, alternation, repetition.
Back-references and capture groups. Splitting on regular
expressions. `grep` and
`grepl` for finding matches. `regexpr` and `gregexpr` for
finding matches, `regmatches` for extracting the matching substrings.
`regexec` for capture groups. Examples of multi-stage processing with
regular expressions. Examples of substitutions with `regmatches`,
`sub` and `gsub`. Things you cannot do with regular expressions.

Examples: Lincoln's 2nd inaugural address; baking brownies with Ms. Alice B. Tolkas; extracting earthquake information from data files.

Introduction to Statistical Computing

**Please comment on the article here:** **Three-Toed Sloth **