The .subn() method wasn't setting _num_regs, which is used by the .groups()
	method, so .groups() didn't work inside the replacement function
	called by re.sub.  One-line fix: set self._num_regs inside subn().
diff --git a/Lib/re.py b/Lib/re.py
index dce29ce..d190363 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -167,6 +167,7 @@
             regs = match(source, pos, end, 0)
             if not regs:
                 break
+            self._num_regs = len(regs)
             i, j = regs[0]
             if i == j == lastmatch:
                 # Empty match adjacent to previous match