Why does re.sub replace the entire pattern, not just a capturing group within it? Why does re.sub replace the entire pattern, not just a capturing group within it? python-3.x python-3.x