Amaury Forgeot d'Arc added the comment: > And why isn't \g<groupname> part of the pattern language, anyway, or at > least some way to refer to a match made in a previous *named* group?
But this way exists: (?P=startquote) is what you want. To me \g is an exception, and frankly I did not know about it before this bug report. I agree that the following sentence could be better structured: """ For example, if the pattern is (?P<id>[a-zA-Z_]\w*), the group can be referenced by its name in arguments to methods of match objects, such as m.group('id') or m.end('id'), and also by name in the regular expression itself (using (?P=id)) and replacement text given to .sub() (using \g<id>). """ It probably needs to be split into several pieces, contributions are welcome. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15956> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com