bpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546)


Need to reset capturing groups between two SRE(match) callings in loops, this fixes wrong capturing groups in rare cases.

Also add a missing index in re.rst.
(cherry picked from commit 4a7f44a2ed49ff1e87db062e7177a56c6e4bbdb0)

Co-authored-by: animalize <animalize@users.noreply.github.com>
5 files changed