Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

It returns not the index of the last character of the substring, but the index 
of the end of the substring, i.e. the position past the last character of the 
substring.

Try s[:sre.end()] and s[sre.end():].

s[sre.begin()] gives you the part of s before the matched substring, 
s[sre.begin():sre.end()] gives you the matched substring itself (the same as 
sre.group()) and s[sre.end():] gives you the part of s after the matched 
substring.

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33368>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to