---
layout: post
title: "Advanced regular expressions in R with str_replace and separate (CC184)"
blurb: "Advanced regular expressions in R"
author: "PD Schloss"
date: 2022-02-03 11:00
comments: false
youtube: YNmpmmYBICo
start_hash: 310ff4a1141e0a460bc6228bda0585cb87d4db11
end_hash: 6e12a7cf418c61509bbdfea79af830fa25dc369d
---

R has a very powerful set of features for building and using regular expressions. In this episode we move beyond the basics and discuss anchors, universal and specific metacharacters, and how to specify groups within a pattern that you can use in the replacement value. Finally, we'll use all this with the separate function. We'll do all this in RStudio using the stringr package.


<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


## Code

You can browse the state of the repository at the
* [beginning of the episode](https://github.com/riffomonas/distances/tree/{{ page.start_hash }})
* [end of the episode](https://github.com/riffomonas/distances/tree/{{ page.end_hash }})
