[issue2636] Regexp 2.7 (modifications to current re 2.2.2)
Matthew Barnett
report at bugs.python.org
Mon Jul 11 19:32:08 CEST 2011
Matthew Barnett <python at mrabarnett.plus.com> added the comment:
The new regex imlementation is hosted here: https://code.google.com/p/mrab-regex-hg/
The span of m['a_thing'] is m.span('a_thing'), if that helps.
The named groups are listed on the pattern object, which can be accessed via m.re:
>>> m.re
<_regex.Pattern object at 0x0161DE30>
>>> m.re.groupindex
{'another_thing': 3, 'a_thing': 1}
so you can use that to create a reverse dict to go from the index to the name or None. (Perhaps the pattern object should have such a .group_name attribute.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2636>
_______________________________________
More information about the Python-bugs-list
mailing list