Python Regex Reference

By Xah Lee. Date: . Last updated: .

Note: This document was originally a rewrite of Python 2.4's Official Documentation of its RE module (, strictly following its style and format. It was written in 2005. However, it has since been rewritten as independent tutorial and reference. For detail, see: Notes on Rewriting Python Regex Documentation

Python Regular Expression