© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
W. YarberryCRAN Recipeshttps://doi.org/10.1007/978-1-4842-6876-6_9

9. The Magnificent Seven

William Yarberry1  
(1)
Kingwood, TX, USA
 

R uses seven regular expression functions for pattern matching and replacement. If you know how to use these functions with appropriate regular expression patterns, then you have a worthy and efficient toolkit for most data science applications.

Let’s look at code using each function.

9.1 grep

9.1.1 Pattern Matching and Replacement

grep: a RegEx pattern which matches string vectors. If “value = TRUE” is specified, matching characters are returned. In other words, if the input = “aabbcc” and the pattern is “aa”, the output will be ...

Get CRAN Recipes: DPLYR, Stringr, Lubridate, and RegEx in R 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.