This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients C. Y. Hollander, docs@python, serhiy.storchaka
Date 2018-04-26.20:03:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1524772983.31.0.682650639539.issue33368@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-04-26 20:03:03serhiy.storchakasetrecipients: + serhiy.storchaka, docs@python, C. Y. Hollander
2018-04-26 20:03:03serhiy.storchakasetmessageid: <1524772983.31.0.682650639539.issue33368@psf.upfronthosting.co.za>
2018-04-26 20:03:03serhiy.storchakalinkissue33368 messages
2018-04-26 20:03:03serhiy.storchakacreate