Roundup Robot added the comment:
New changeset bee2736296c5 by Georg Brandl in branch '2.7':
Closes #15956: improve documentation of named groups and how to reference them.
http://hg.python.org/cpython/rev/bee2736296c5
--
nosy: +python-dev
resolution: - fixed
stage: patch review -
Roundup Robot added the comment:
New changeset f765a29309d1 by Georg Brandl in branch '3.3':
Closes #15956: improve documentation of named groups and how to reference them.
http://hg.python.org/cpython/rev/f765a29309d1
--
___
Python tracker
Georg Brandl added the comment:
Thanks for the patch. I made a few changes, such as explaining what the
example pattern does.
--
nosy: +georg.brandl
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15956
Terry J. Reedy added the comment:
I read it as a 'native speaker' and it looks fine to me. Table is clear, but I
will let doc stylist decide.
--
nosy: +terry.reedy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15956
Amaury Forgeot d'Arc added the comment:
And why isn't \ggroupname 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
Matthew Barnett added the comment:
There needed to be a way of referring to named groups in the replacement
template. The existing form \groupnumber clearly wouldn't work. Other regex
implementations, such as Perl, do have \g and also \k (for named groups).
In my implementation I added
Steve Newcomb added the comment:
But this way exists: (?P=startquote) is what you want.
I know how I missed it: I searched for backref in the documentation. I did
not find it in the discussion of the pattern language, because that word does
not appear where ?P= is discussed.
contributions
Amaury Forgeot d'Arc added the comment:
Thanks for the patch! The new formulation looks much better, but I'll let a
native speaker have another check.
Some comments: I preferred the previous example id because it's not obvious
what \042\047 is. And a bullet list would be less heavyweight
Steve Newcomb added the comment:
I preferred the previous example id because it's not obvious what
\042\047 is.
Yeah, but the example I wrote has an in-pattern backreference and a real reason
to use one.
In the attached patch, I have changed [\042\047] to [\'\]. That's certainly
clearer
Changes by Amaury Forgeot d'Arc amaur...@gmail.com:
--
assignee: - docs@python
nosy: +docs@python
stage: committed/rejected - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15956
Changes by Andrew Svetlov andrew.svet...@gmail.com:
--
nosy: +asvetlov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15956
___
___
New submission from Steve Newcomb:
The '\\gstartquote' in the below does not work:
repr( re.compile( '!ENTITY[ \\011\\012\\015]+\\%[
\\011\\012\\015]*(?PentityName[A-Za-z][A-Za-z0-9\\.\\-\\_\\:]*)[
\\011\\012\\015]*(?Pstartquote[\\042\\047])(?PentityText.+?)\\gstartquote[
Amaury Forgeot d'Arc added the comment:
\g is meant to be used in re.sub(), in the replacement text (see the docs); in
the search pattern, (?P=startquote) can be used to refer to a named group.
The docs of (?Pname...) looks clear to me.
--
nosy: +amaury.forgeotdarc
resolution: -
Steve Newcomb added the comment:
I have re-read the documentation on re.sub(). Even now, now that I understand
that the \ggroupname syntax applies to the repl argument only, I cannot see
how the documentation can be understood that way. The paragraph in which the
explanation of the
14 matches
Mail list logo