Show Menu
Cheatography

Python Regex Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Characters

Character
Matches
a
a character
.
Any character
\.
. character
\\
\ character
\*
* character
 

Character Classes

Matches
 
Descri­ption
[abcd]
Any one of the letters a through d
Set of characters
[^abcd]
Any character but a, b, c, or d
Complement of a set of characters
[a-d]
Any one of the letters a through d
Range of characters
[a-dz]
Any of a, b, c, d, or z
Range of characters

Character Classes (copy)

Matches
 
Descri­ption
[abcd]
Any one of the letters a through d
Set of characters
[^abcd]
Any character but a, b, c, or d
Complement of a set of characters
[a-d]
Any one of the letters a through d
Range of characters
[a-dz]
Any of a, b, c, d, or z
Range of characters