alec resnick aresnick...@gmail.com added the comment:
Hi Georg!
Sorry to be so long in getting back to you. I've attached a suggested
patch for the python-2.6.1-docs-text/library/re.txt documentation.
Also, in looking over Kuchling's HOWTO, the necessary information is
actually there, and I just wasn't paying attention =) Let me know if
I should do something else--this is my first 'fix'/submission to
Python, and I'm eager for feedback.
Thanks!
Gratefully,
a.
--
keywords: +patch
Added file:
http://bugs.python.org/file13016/re-backreference-clarification.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4882
___*** /home/aresnick/Desktop/python-2.6.1-docs-text/library/re.txt
2009-01-04 01:25:41.0 -0500
--- modified-re.txt 2009-02-10 12:38:30.0 -0500
***
*** 242,254
or referenced later in the pattern.
``(?Pname...)``
Similar to regular parentheses, but the substring matched by the
!group is accessible via the symbolic group name *name*. Group
!names must be valid Python identifiers, and each group name must be
!defined only once within a regular expression. A symbolic group is
!also a numbered group, just as if the group were not named. So the
!group named 'id' in the example below can also be referenced as the
!numbered group 1.
For example, if the pattern is ``(?Pid[a-zA-Z_]\w*)``, the group
can be referenced by its name in arguments to methods of match
--- 242,256
or referenced later in the pattern.
``(?Pname...)``
+
Similar to regular parentheses, but the substring matched by the
!group is accessible within the rest of the regular expression via
!the symbolic group name *name*. Group names must be valid Python
!identifiers, and each group name must be defined only once within a
!regular expression. A symbolic group is also a numbered group,
!just as if the group were not named. So the group named 'id' in
!the example below can also be referenced (within the regular
!expression) as the numbered group 1.
For example, if the pattern is ``(?Pid[a-zA-Z_]\w*)``, the group
can be referenced by its name in arguments to methods of match
***
*** 256,264
name in pattern text (for example, ``(?P=id)``) and replacement
text (such as ``\gid``).
! ``(?P=name)``
Matches whatever text was matched by the earlier group named
!*name*.
``(?#...)``
A comment; the contents of the parentheses are simply ignored.
--- 258,268
name in pattern text (for example, ``(?P=id)``) and replacement
text (such as ``\gid``).
! ``(?P=name)``
Matches whatever text was matched by the earlier group named
!*name*. This can only be used within the regular expression. To
!reference the captured group, pass the group's name as an argument
!to the method of a match object, e.g. ``m.group('name')``.
``(?#...)``
A comment; the contents of the parentheses are simply ignored.
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com