[docs] [issue14155] Deja vu in re's documentation
report at bugs.python.org
Thu Mar 1 22:53:51 CET 2012
py.user <port139 at yandex.ru> added the comment:
I won't open another topic:
"Most of the standard escapes supported by Python string literals
are also accepted by the regular expression parser:
\a \b \f \n
\r \t \v \x
\b can be used only in character set , when others can be used without it
"Octal escapes are included in a limited form.
If the first digit is a 0, or if there are three octal digits,
it is considered an octal escape. Otherwise, it is a group reference.
As for string literals, octal escapes are always at most three digits in length."
description of the back refference:
Matches the contents of the group of the same number.
Groups are numbered starting from 1. For example, (.+) \1 matches 'the the' or '55 55',
but not 'the end' (note the space after the group).
This special sequence can only be used to match one of the first 99 groups.
If the first digit of number is 0, or number is 3 octal digits long,
it will not be interpreted as a group match, but as the character with octal value number.
Inside the '[' and ']' of a character class, all numeric escapes are treated as characters."
Python tracker <report at bugs.python.org>
More information about the docs