Group names must be valid Python identifiers, and each group name must be defined only once within a regular expression.
However, the following code returns no error on IronPython 2.7.7, and yields a strange value.
This code should be an error.
IronPython 2.7.7 (2.7.7.0) on .NET 4.0.30319.1 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> ptn = re.compile(r'(?P<hoge>\w+):(?P<hoge>\w+)')
>>> ptn.match('hoge:fuga')
<RE_Match object at 0x000000000000006D>
>>> _.group('hoge')
'fuga'
The duplication of symbolic group names on regular expression is prohibited on CPython's
re
module. https://docs.python.org/2/library/re.html#regular-expression-syntaxHowever, the following code returns no error on IronPython 2.7.7, and yields a strange value. This code should be an error.