1 min read

Regular expressions in Stata cheat sheet

The cheat sheet below is based off this great cheat sheet for regular expressions in R by Ian Kopacka.

This is not supposed to be used as an introduction to regular expressions (have a look at the relevant help files and some of the materials shared below for this).

This is also not a complete set of anchors, characters etc for matching, but those shown should be sufficient for most tasks (certainly for what I do at least!).

A few useful links related to regular expressions in Stata:

To open the pdf below in its own page click here.