The Matching Characters

Let's discuss how to match characters in the string using regular expressions.

Overview

When we want to match a character in a string, in most cases we can just use that character or that substring. So if we wanted to match “dog”, then we would use the letters dog. Of course, there are some characters that are reserved for regular expressions. These are known as metacharacters. The following is a complete list of the metacharacters that Python’s regular expression implementation supports:

. ^ $ * + ? { } [ ] | ( )

Get hands-on with 1200+ tech skills courses.