[Python-checkins] r57354 - python/trunk/Doc/library/re.rst

georg.brandl python-checkins at python.org
Thu Aug 23 23:36:05 CEST 2007


Author: georg.brandl
Date: Thu Aug 23 23:36:05 2007
New Revision: 57354

Modified:
   python/trunk/Doc/library/re.rst
Log:
Bug #1625381: clarify match vs search introduction.


Modified: python/trunk/Doc/library/re.rst
==============================================================================
--- python/trunk/Doc/library/re.rst	(original)
+++ python/trunk/Doc/library/re.rst	Thu Aug 23 23:36:05 2007
@@ -393,12 +393,12 @@
 
 
 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*


More information about the Python-checkins mailing list