[issue7132] Regexp: capturing groups in repetitions

Matthew Barnett report at bugs.python.org
Thu Oct 15 02:50:33 CEST 2009


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

Instead of a new flag, a '*' could be put after the quantifier, eg:

    (\d+)(?:\.(\d+)){3}*

MatchObject.group(1) would be a string and MatchObject.group(2) would be
a list of strings.

The group references could be \g<1>, \g<2:0>, \g<2:1>, \g<2:2>.

However, I think that it's extending regexes too far; something else
should be used, eg pyparsing or some type of context-free grammar with
optional constraints.

-1 from me

----------
nosy: +mrabarnett

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7132>
_______________________________________


More information about the Python-bugs-list mailing list