Chapter 2: Regular expression basics

Diving straight in!

face Josiah Wang

Let’s get practical! Time to get your hands dirty with regular expressions! Reading will not get you anywhere when it comes to regular expressions!

I will start simple, and then start giving you more regular expression constructs to write more powerful regular expressions!

And remember that while we will use Python for our implementation, the concepts you will learn in this chapter can be applied anywhere from shell commands to text editors!

Please follow along and try things out yourself! Launch an interactive Python prompt, and import the re module from the Python Standard Library!

>>> import re

And let’s get started!