[docs] bug in re documentation (python 3.3.2)
Alexander Heger
alex.heger at gmail.com
Thu Jun 27 02:26:03 CEST 2013
http://docs.python.org/3.3/library/re.html
6.2.1. Regular Expression Syntax
(way down)
it says:
\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.
The example of what does not work is wrong
In [1]: import re
In [2]: re.findall(r'(.+) \1','the end')
Out[2]: ['e']
It probably should be
\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
'thethe' (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.
-Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130627/8699f3fa/attachment-0001.html>
More information about the docs
mailing list