Built-in Module regex

This module provides regular expression matching operations similar to those found in Emacs. It is always available.

By default the patterns are Emacs-style regular expressions; there is a way to change the syntax to match that of several well-known Unix<#1563#><#1563#> utilities.

This module is 8-bit clean: both patterns and strings may contain null bytes and characters whose high bit is set.

Please note: There is a little-known fact about Python string literals which means that you don't usually have to worry about doubling backslashes, even though they are used to escape special characters in string literals as well as in regular expressions. This is because Python doesn't remove backslashes from string literals if they are followed by an unrecognized escape character. However, if you want to include a literal backslash in a regular expression represented as a string literal, you have to quadruple it. E.g. to extract LaTeX <#5109#>section{<#1568#> ...<#1568#>}<#5109#> headers from a document, you can use this pattern: `'section{(.*)}''.

The module defines these functions, and an exception:


#funcdesc1572#


#funcdesc1579#


#funcdesc1585#


#funcdesc1601#


#funcdesc1610#


#excdesc1618#


#datadesc1621#

Compiled regular expression objects support these methods:


#funcdesc1628#


#funcdesc1637#


#funcdesc1645#

Compiled regular expressions support these data attributes:


#datadesc1661#


#datadesc1669#


#datadesc1675#


#datadesc1683#


#datadesc1688#


#datadesc1693#