Updated: 📆 2018-04-06.
Regular Expressions, RegEx, regexps– call them what you like, but no matter how you slice it, they’re useful af. After all, data spelunking is all about patterns, and that’s precisely what regexps are for: (wo)manhandling patterns in strings. Good Sirs Wickham and Grolemund, in their masterful tome, r4ds, describe them thusly:
They [regexps] take a little while to get your head around, but once you understand them, you’ll find them extremely useful.1
There are helpful string-related R packages 📦,
stringr (which is built on top of the more comprehensive
stringi package) comes to mind. But, at some point in your computing life, you’re gonna need to get down with regular expressions.
Below you’ll find a collection of some of the Regex-related links I’ve tweeted 🐦:
Basic Regular Expressions in R Cheat Sheet by Ian Kopacka
strings and regular expressions by Lise Vaudor
Quick Guide to Regex in R by Ben Gorman
An Introduction to stringr and Regular Expressions by Brian Espinoza
qdapRegex 📦 by Tyler Rinker
RegexOne simple, interactive exercises
Regular expressions in
swirl by Jon Calder
stringr cheat sheet from RStudio
As always, by all means let me know if you’ve written something you think I should add: chirp my way (🐦 @dataandme), comment– you know the drill.
Wickham, Hadley and Garrett Grolemund. 2016. R for Data Science. Sebastopol: O’Reilly Media. Web. http://r4ds.had.co.nz/strings.html#matching-patterns-with-regular-expressions 20 September, 2017.↩