Skip to content
R for the Rest of Us Logo

This lesson is locked

Get access to all lessons in this course.

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Match the following regular expressions against the test vector below using str_detect. Can you explain the matches?

Regular expressions

  1. ^dog

  2. ^[a-z]+$

  3. \\d

test_vector <- c("Those dogs are small.","dogs and cats",
                 "34","(34)","rat","watchdog","placemat",
                 "BABY","2011_April","mice")

Learn More

To learn more about the stringr package, check out the documentation website. There is also a stringr cheatsheet. You also might check out Chapter 14 of R for Data Science as well as this blog post by Hugo Toscano on working with strings in R.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.