Skip to content
No description or website provided.
Jupyter Notebook
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Regular expressions in Python



Do you need to clean up some text data? You need regular expressions!

What you'll learn

  • Which problems regular expressions can help you solve, and which they cannot.
  • Regular expression syntax, including the difference between literal characters and metacharacters.
  • How to use regular expressions to solve real world problems.


Although the workshop can be completed without a background in Python, familiarity with Python is strongly encouraged. We use Python as a way of demonstrating what regular expressions can do, but the core substance is on regular expressions, which are present in all modern programming languages and text editors. A level of Python of our FUN!damentals series is encouraged.

Getting started & software prerequisites

There are three ways to get started with these materials, with each of them requiring different software installed on your computer.


If you're taking this workshop at D-Lab, then your instructor will have set up JupyterHub for your workshop. The JupyterHub allows you to run code on a remote computer but see the results on yours. For this method, the only software you need is a modern web browser (we suggest Google Chrome). Your instructor will give you a URL on the day. This is our recommended method.


If you want to run the code on your computer, you have two options. Both involve installing (or making sure you have installed) Python 3 and some additional libraries. Anaconda is a free product that makes the installation process easy. It bundles together the Python language and a whole bunch of additional packages that we often rely on in our workshops. This way, you only have to download and install one thing. To use this method, visit this site and follow the instructions for your operating system to download the Python 3.x version (it might be 3.6, or 3.7, or higher). Please, please, please download the 3.x version, not the Python 2.x version. You may have a choice between using the graphical installer or the command line installer. Use whichever you're comfortable with, but the graphical one is easier.

For Pythonistas

If you've been using Python for a while, you might not want to use Anaconda. First, make sure you have a Python 3.x version. Second, install Jupyter by following these instructions. Third, install the packages listed in the requirements.txt file of this repo. The easiest way to do this is:

pip3 install -r requirements.txt


It's OK Not To Know! That's our motto at D-Lab. D-Lab is open to researchers and professionals from all disciplines and levels of experience.



If you spot a problem with these materials, please make an issue describing the problem.


  • Geoff Bacon


  • Chris Hench
  • Natalie Ahn

dlab logo

You can’t perform that action at this time.