Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Strange behavior of symbolic group name on regular expression module. #1664

Closed
utgwkk opened this issue May 31, 2017 · 1 comment
Closed

Comments

@utgwkk
Copy link

utgwkk commented May 31, 2017

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-syntax

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'
@slide
Copy link
Contributor

slide commented Jun 6, 2017

This issue was moved to IronLanguages/ironpython2#21

@slide slide closed this as completed Jun 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants