1. Learn
  2. /
  3. Courses
  4. /
  5. String Manipulation with stringr in R

Connected

Exercise

Hunting for phone numbers

For your first task you are going to pull out the phone numbers from this vector of contact information:

contact

You'll assume the phone numbers you are looking for follow the American standard of a three digit area code, a three digit exchange and then a four digit number, but each part could be separated by spaces or various punctuation symbols.

Instructions 1/4

undefined XP
    1
    2
    3
    4

Phone numbers start with three digits. Create a pattern that matches three digits in a row. Use str_view_all() to test your pattern.