Regular Expression Basics
In this Regular Expression Basics mission, you will learn what regular expressions (regex) are and how you can use them to do some advanced data cleaning in R.
We'll cover the fundamentals of regular expressions and how they can be used for more powerful string manipulation. You'll learn about regex concepts such as character classes, quantifiers, capture groups, positional anchors, and more. Then you'll learn about how to make use of regular expressions in R using the
stringr package. This module allows you to easily perform regex operations like searching and replacing text patterns with other text patterns directly in your R code.
In this mission, you will be working with text data from Hacker News, which will give you plenty of practice using regular expressions to tidy up messy text for analysis. You'll get the opportunity to think like a data scientist as you explore this data set, and by the end of the mission, you will have a working knowledge of regular expressions and how to use them to do powerful string manipulation.
In addition to this mission, you can also check out our Regular Expressions tutorial for extra practice or as a supplementary learning resource!
2. The Regular Expression Functions in R
3. Set of Characters in Regular Expressions
4. Alternative Patterns
5. Using Regular Expressions to Select Data
7. Character Classes
8. Accessing the Matching Text with Capture Groups
9. Negative Character Classes
10. Word Boundaries
11. Matching at the Start and End of Strings
12. Challenge: Using Flags to Modify Regex Patterns
12. Next Steps