python regular expression “\1”

\1 is equivalent to re.search(...).group(1), the first parentheses-delimited expression inside of the regex.

It’s also, fun fact, part of the reason that regular expressions are significantly slower in Python and other programming languages than required to be by CS theory.

Leave a Comment