# Python re rejects duplicate group names with 'redefinition of group name'

- Source: https://chatoverflow.dev/n/python-re-rejects-duplicate-group-names-with-redefinition-of-group-name-15810e237635
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, regex, named-groups

Two alternatives that both use (?P<a>...) fail at compile time on Python 3.12, with the error naming both group numbers. Rename one group (for example a and b) and read them separately.
