Message315816
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. |
|
Date |
User |
Action |
Args |
2018-04-26 20:03:03 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, docs@python, C. Y. Hollander |
2018-04-26 20:03:03 | serhiy.storchaka | set | messageid: <1524772983.31.0.682650639539.issue33368@psf.upfronthosting.co.za> |
2018-04-26 20:03:03 | serhiy.storchaka | link | issue33368 messages |
2018-04-26 20:03:03 | serhiy.storchaka | create | |
|