[issue14155] Deja vu in re's documentation

py.user 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:
1)
http://docs.python.org/py3k/library/re.html#regular-expression-syntax
"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

2)
http://docs.python.org/py3k/library/re.html#regular-expression-syntax
"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."

http://docs.python.org/py3k/library/re.html#regular-expression-syntax
description of the back refference:
"\number
    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."


a duplicate

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14155>
_______________________________________


More information about the Python-bugs-list mailing list