summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-08-23 21:36:05 (GMT)
committerGeorg Brandl <georg@python.org>2007-08-23 21:36:05 (GMT)
commit604c121eee4a3faef0c242342bc6b73cae46fd28 (patch)
tree78a74b69f0a82de069f0f667fd2cb5515905a449
parentda5f16ab19db54f5801489b8d0caadea793ec187 (diff)
downloadcpython-604c121eee4a3faef0c242342bc6b73cae46fd28.zip
cpython-604c121eee4a3faef0c242342bc6b73cae46fd28.tar.gz
cpython-604c121eee4a3faef0c242342bc6b73cae46fd28.tar.bz2
Bug #1625381: clarify match vs search introduction.
-rw-r--r--Doc/library/re.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 027ff16..d5abcdd 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -393,12 +393,12 @@ Matching vs Searching
Python offers two different primitive operations based on regular expressions:
-match and search. If you are accustomed to Perl's semantics, the search
-operation is what you're looking for. See the :func:`search` function and
-corresponding method of compiled regular expression objects.
+**match** checks for a match only at the beginning of the string, while
+**search** checks for a match anywhere in the string (this is what Perl does
+by default).
-Note that match may differ from search using a regular expression beginning with
-``'^'``: ``'^'`` matches only at the start of the string, or in
+Note that match may differ from search even when using a regular expression
+beginning with ``'^'``: ``'^'`` matches only at the start of the string, or in
:const:`MULTILINE` mode also immediately following a newline. The "match"
operation succeeds only if the pattern matches at the start of the string
regardless of mode, or at the starting position given by the optional *pos*