Serhiy Storchaka added the comment: I don't think the documentation is wrong. re.search() returns first match, and this is empty string at position 0.
>>> import re >>> re.search('1?', '01') <_sre.SRE_Match object; span=(0, 0), match=''> All matches: >>> list(re.findall('1?', '01')) ['', '1', ''] >>> list(re.finditer('1?', '01')) [<_sre.SRE_Match object; span=(0, 0), match=''>, <_sre.SRE_Match object; span=(1, 2), match='1'>, <_sre.SRE_Match object; span=(2, 2), match=''>] ---------- nosy: +ezio.melotti, pitrou, serhiy.storchaka resolution: -> invalid _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19964> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com