You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/freddrake'closed_at=<Date2007-08-23.21:36:17.560>created_at=<Date2006-12-31.16:42:04.000>labels= ['docs']
title='re module documentation on search/match is unclear'updated_at=<Date2007-08-23.21:36:17.558>user='https://bugs.python.org/richardb'
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."
+1 on the general idea, though I'd change your "match() checks for a match at the beginning..." to "match() checks for a match starting at the beginning...". I'd also like to drop the reference to Perl entirely; saying that I should look to search() for Perl's semantics makes it sound like match() doesn't support PCREs.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: