ID EN
Regular Expression

expand

Python 3.11

Return the string obtained by doing backslash substitution on the template string template, as done by the sub() method. Escapes such as \n are converted to the appropriate characters, and numeric backreferences (\1, \2) and named backreferences (\g, \g) are replaced by the contents of the corresponding group. The backreference \g will be replaced by the entire match.

Syntax

PYTHON
Match.expand(template)

See Also

sub()