Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
74f8fc0b
Commit
74f8fc0b
authored
Jul 26, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6576: fix cross-refs in re docs.
parent
982b2fa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
Doc/library/re.rst
Doc/library/re.rst
+26
-23
No files found.
Doc/library/re.rst
View file @
74f8fc0b
...
...
@@ -216,7 +216,7 @@ The special characters are:
flags are described in :ref:`contents-of-module-re`.) This
is useful if you wish to include the flags as part of the regular
expression, instead of passing a *flag* argument to the
:func:`compile` function.
:func:`
re.
compile` function.
Note that the ``(?x)`` flag changes how the expression is parsed. It should be
used first in the expression string, or after one or more whitespace characters.
...
...
@@ -443,9 +443,9 @@ form.
result = re.match(pattern, string)
but using :func:`
compile` and saving the resulting regular expression object
for reuse is more efficient when the expression will be used several times
in a single program.
but using :func:`
re.compile` and saving the resulting regular expression
object for reuse is more efficient when the expression will be used several
times
in a single program.
.. note::
...
...
@@ -532,7 +532,7 @@ form.
.. note::
If you want to locate a match anywhere in *string*, use :
meth
:`search`
If you want to locate a match anywhere in *string*, use :
func
:`search`
instead.
...
...
@@ -699,8 +699,8 @@ attributes:
.. note::
If you want to locate a match anywhere in *string*, use
:meth:`search`
instead.
If you want to locate a match anywhere in *string*, use
:meth:`~RegexObject.search`
instead.
The optional second parameter *pos* gives an index in the string where the
search is to start; it defaults to ``0``. This is not completely equivalent to
...
...
@@ -729,7 +729,7 @@ attributes:
is different from finding a zero-length match at some point in the string.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`match` method.
:meth:`
~RegexObject.
match` method.
.. method:: RegexObject.split(string[, maxsplit=0])
...
...
@@ -793,10 +793,10 @@ support the following methods and attributes:
.. method:: MatchObject.expand(template)
Return the string obtained by doing backslash substitution on the template
string *template*, as done by the :meth:`
sub` method. Escapes such as ``\n`` are
converted to the appropriate characters, and numeric backreferences (``\1``,
``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the
contents of the corresponding group.
string *template*, as done by the :meth:`
~RegexObject.sub` method. Escapes
such as ``\n`` are converted to the appropriate characters, and numeric
backreferences (``\1``, ``\2``) and named backreferences (``\g<1>``,
``\g<name>``) are replaced by the
contents of the corresponding group.
.. method:: MatchObject.group([group1, ...])
...
...
@@ -920,16 +920,16 @@ support the following methods and attributes:
.. attribute:: MatchObject.pos
The value of *pos* which was passed to the :
func:`search` or :func:`match`
method of the :class:`RegexObject`. This is the index into the string at which
the RE engine started looking for a match.
The value of *pos* which was passed to the :
meth:`~RegexObject.search` or
:meth:`~RegexObject.match` method of the :class:`RegexObject`. This is the
index into the string at which
the RE engine started looking for a match.
.. attribute:: MatchObject.endpos
The value of *endpos* which was passed to the :
func:`search` or :func:`match`
method of the :class:`RegexObject`. This is the index into the string beyond
which the RE engine will not go.
The value of *endpos* which was passed to the :
meth:`~RegexObject.search` or
:meth:`~RegexObject.match` method of the :class:`RegexObject`. This is the
index into the string beyond
which the RE engine will not go.
.. attribute:: MatchObject.lastindex
...
...
@@ -949,13 +949,15 @@ support the following methods and attributes:
.. attribute:: MatchObject.re
The regular expression object whose :meth:`match` or :meth:`search` method
produced this :class:`MatchObject` instance.
The regular expression object whose :meth:`~RegexObject.match` or
:meth:`~RegexObject.search` method produced this :class:`MatchObject`
instance.
.. attribute:: MatchObject.string
The string passed to :func:`match` or :func:`search`.
The string passed to :meth:`~RegexObject.match` or
:meth:`~RegexObject.search`.
Examples
...
...
@@ -1000,8 +1002,9 @@ To match this with a regular expression, one could use backreferences as such:
>>> displaymatch(pair.match("354aa")) # Pair of aces.
"<Match: '354aa', groups=('a',)>"
To find out what card the pair consists of, one could use the :func:`group`
method of :class:`MatchObject` in the following manner:
To find out what card the pair consists of, one could use the
:meth:`~MatchObject.group` method of :class:`MatchObject` in the following
manner:
.. doctest::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment