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.
Posted at November 09, 2012 09:30 | permanent link