[New-bugs-announce] [issue4882] Behavior of backreferences to named groups in regular expressions unclear
report at bugs.python.org
Thu Jan 8 16:35:46 CET 2009
New submission from alec resnick <aresnickety at gmail.com>:
I recently learned about named groups in Python regular expressions.
Almost all the documentation I've found online explains what they are
and give a simple example of how to use them. I was trying to use the
variables outside of the original regex, later in the code. Nowhere in
the documentation I found after a couple hours of searching was it
mentioned that named groups can only be backreferenced _within_ the pattern.
In particular, the sections at
the description of the (?P<name>) behavior at
http://docs.python.org/library/re.html could be modified to make it
clear that the named capture does not create a variable usable outside
of the pattern.
I would be happy to alter the documentation appropriately.
nosy: aresnick, georg.brandl
title: Behavior of backreferences to named groups in regular expressions unclear
type: feature request
versions: Python 2.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce