Regular expressions (also called RE or regexes) are a tiny, specialized programming language which can be used to do pattern matching and extract parts of a string.


If you have an address column that is formatted like this:

123 Cherry Road, Mobile, AL 36571
9 Main St, New York, NY 10022
3050 Hollywood Blvd, Los Angeles, CA 90210

Then you could extract the state abbreviation by searching for two uppercase letters followed by a space and five digits, like this

([A-Z][A-Z]) \d\d\d\d\d

[A-Z] means any uppercase letter, and \d means any digit. The parentheses specify which part of the matched string to extract into a new column.

⭐️ Resources

Test your string in Pythex (Workbench uses Python Regex)
This very handy cheatsheets will get you started.
This tutorial will help you build great skill.

Did this answer your question?