This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, ezio.melotti, mrabarnett, steve.newcomb
Date 2012-09-18.07:42:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347954167.04.0.574429110649.issue15956@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-09-18 07:42:47amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, ezio.melotti, mrabarnett, steve.newcomb
2012-09-18 07:42:47amaury.forgeotdarcsetmessageid: <1347954167.04.0.574429110649.issue15956@psf.upfronthosting.co.za>
2012-09-18 07:42:46amaury.forgeotdarclinkissue15956 messages
2012-09-18 07:42:46amaury.forgeotdarccreate