Commit 604c121e authored by Georg Brandl's avatar Georg Brandl

Bug #1625381: clarify match vs search introduction.

parent da5f16ab
...@@ -393,12 +393,12 @@ Matching vs Searching ...@@ -393,12 +393,12 @@ Matching vs Searching
Python offers two different primitive operations based on regular expressions: Python offers two different primitive operations based on regular expressions:
match and search. If you are accustomed to Perl's semantics, the search **match** checks for a match only at the beginning of the string, while
operation is what you're looking for. See the :func:`search` function and **search** checks for a match anywhere in the string (this is what Perl does
corresponding method of compiled regular expression objects. by default).
Note that match may differ from search using a regular expression beginning with Note that match may differ from search even when using a regular expression
``'^'``: ``'^'`` matches only at the start of the string, or in beginning with ``'^'``: ``'^'`` matches only at the start of the string, or in
:const:`MULTILINE` mode also immediately following a newline. The "match" :const:`MULTILINE` mode also immediately following a newline. The "match"
operation succeeds only if the pattern matches at the start of the string 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* regardless of mode, or at the starting position given by the optional *pos*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment