Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f346ac0

Browse files
committed
Merged revisions 74205 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r74205 | georg.brandl | 2009-07-26 15:36:39 +0200 (So, 26 Jul 2009) | 1 line #6576: fix cross-refs in re docs. ........
1 parent 502d9a5 commit f346ac0

1 file changed

Lines changed: 26 additions & 23 deletions

File tree

Doc/library/re.rst

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ The special characters are:
221221
flags are described in :ref:`contents-of-module-re`.) This
222222
is useful if you wish to include the flags as part of the regular
223223
expression, instead of passing a *flag* argument to the
224-
:func:`compile` function.
224+
:func:`re.compile` function.
225225

226226
Note that the ``(?x)`` flag changes how the expression is parsed. It should be
227227
used first in the expression string, or after one or more whitespace characters.
@@ -464,9 +464,9 @@ form.
464464

465465
result = re.match(pattern, string)
466466

467-
but using :func:`compile` and saving the resulting regular expression object
468-
for reuse is more efficient when the expression will be used several times
469-
in a single program.
467+
but using :func:`re.compile` and saving the resulting regular expression
468+
object for reuse is more efficient when the expression will be used several
469+
times in a single program.
470470

471471
.. note::
472472

@@ -564,7 +564,7 @@ form.
564564

565565
.. note::
566566

567-
If you want to locate a match anywhere in *string*, use :meth:`search`
567+
If you want to locate a match anywhere in *string*, use :func:`search`
568568
instead.
569569

570570

@@ -720,8 +720,8 @@ attributes:
720720

721721
.. note::
722722

723-
If you want to locate a match anywhere in *string*, use :meth:`search`
724-
instead.
723+
If you want to locate a match anywhere in *string*, use
724+
:meth:`~RegexObject.search` instead.
725725

726726
The optional second parameter *pos* gives an index in the string where the
727727
search is to start; it defaults to ``0``. This is not completely equivalent to
@@ -750,7 +750,7 @@ attributes:
750750
is different from finding a zero-length match at some point in the string.
751751

752752
The optional *pos* and *endpos* parameters have the same meaning as for the
753-
:meth:`match` method.
753+
:meth:`~RegexObject.match` method.
754754

755755

756756
.. method:: RegexObject.split(string[, maxsplit=0])
@@ -814,10 +814,10 @@ support the following methods and attributes:
814814
.. method:: MatchObject.expand(template)
815815

816816
Return the string obtained by doing backslash substitution on the template
817-
string *template*, as done by the :meth:`sub` method. Escapes such as ``\n`` are
818-
converted to the appropriate characters, and numeric backreferences (``\1``,
819-
``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the
820-
contents of the corresponding group.
817+
string *template*, as done by the :meth:`~RegexObject.sub` method. Escapes
818+
such as ``\n`` are converted to the appropriate characters, and numeric
819+
backreferences (``\1``, ``\2``) and named backreferences (``\g<1>``,
820+
``\g<name>``) are replaced by the contents of the corresponding group.
821821

822822

823823
.. method:: MatchObject.group([group1, ...])
@@ -938,16 +938,16 @@ support the following methods and attributes:
938938

939939
.. attribute:: MatchObject.pos
940940

941-
The value of *pos* which was passed to the :func:`search` or :func:`match`
942-
method of the :class:`RegexObject`. This is the index into the string at which
943-
the RE engine started looking for a match.
941+
The value of *pos* which was passed to the :meth:`~RegexObject.search` or
942+
:meth:`~RegexObject.match` method of the :class:`RegexObject`. This is the
943+
index into the string at which the RE engine started looking for a match.
944944

945945

946946
.. attribute:: MatchObject.endpos
947947

948-
The value of *endpos* which was passed to the :func:`search` or :func:`match`
949-
method of the :class:`RegexObject`. This is the index into the string beyond
950-
which the RE engine will not go.
948+
The value of *endpos* which was passed to the :meth:`~RegexObject.search` or
949+
:meth:`~RegexObject.match` method of the :class:`RegexObject`. This is the
950+
index into the string beyond which the RE engine will not go.
951951

952952

953953
.. attribute:: MatchObject.lastindex
@@ -967,13 +967,15 @@ support the following methods and attributes:
967967

968968
.. attribute:: MatchObject.re
969969

970-
The regular expression object whose :meth:`match` or :meth:`search` method
971-
produced this :class:`MatchObject` instance.
970+
The regular expression object whose :meth:`~RegexObject.match` or
971+
:meth:`~RegexObject.search` method produced this :class:`MatchObject`
972+
instance.
972973

973974

974975
.. attribute:: MatchObject.string
975976

976-
The string passed to :func:`match` or :func:`search`.
977+
The string passed to :meth:`~RegexObject.match` or
978+
:meth:`~RegexObject.search`.
977979

978980

979981
Examples
@@ -1018,8 +1020,9 @@ To match this with a regular expression, one could use backreferences as such:
10181020
>>> displaymatch(pair.match("354aa")) # Pair of aces.
10191021
"<Match: '354aa', groups=('a',)>"
10201022

1021-
To find out what card the pair consists of, one could use the :func:`group`
1022-
method of :class:`MatchObject` in the following manner:
1023+
To find out what card the pair consists of, one could use the
1024+
:meth:`~MatchObject.group` method of :class:`MatchObject` in the following
1025+
manner:
10231026

10241027
.. doctest::
10251028

0 commit comments

Comments
 (0)