[ python-Bugs-1625381 ] re module documentation on search/match is unclear

SourceForge.net noreply at sourceforge.net
Sun Dec 31 17:42:04 CET 2006


Bugs item #1625381, was opened at 2006-12-31 16:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1625381&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Richard Boulton (richardb)
Assigned to: Nobody/Anonymous (nobody)
Summary: re module documentation on search/match is unclear

Initial Comment:
Section 4.2.2 ("Matching vs Searching") of the Python Library Reference covers the match and search methods of regular expression objects.  However, it doesn't begin by describing the difference between these methods.  Each time I try to remember which way round match and search are, it takes several minutes of checking the documentation to work out which is which. I suggest that the first paragraph of the section is replaced with the following text (in two paragraphs), to make the distinction between the methods clearer:

"Python offers two different primitive operations based on regular expressions: match and search.  match() checks for a match at the beginning of the search string, whereas search() checks for a match anywhere in the string.

If you want something equivalent to Perl's semantics, the search operation is what you're looking for. See the search() function and corresponding method of compiled regular expression objects."

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1625381&group_id=5470


More information about the Python-bugs-list mailing list