This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients docs@python, r.david.murray, serhiy.storchaka, steven.daprano, vrutsky
Date 2012-10-23.22:23:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I don't think the relevant information -- that re match and search return None in the case of no match -- is that distant from the paragraph quoted. This fact is already mentioned FOUR times in the page, in each of the re.match, functions and regex.match, methods, plus implied by the helper function used in the examples.

Personally I think no change is required, but if the docs are going to be changed, I recommend going all the way and showing the usual re idiom with an example:

Match Objects always have a boolean value of ``True``.  Since ``None`` (which has a boolean value of ``False``) is returned when there is no match, you can test whether there was a match with a simple ``if`` statement. For example::

mo =, string)
if mo:
Date User Action Args
2012-10-23 22:23:26steven.dapranosetrecipients: + steven.daprano, r.david.murray, docs@python, vrutsky, serhiy.storchaka
2012-10-23 22:23:26steven.dapranosetmessageid: <>
2012-10-23 22:23:26steven.dapranolinkissue16304 messages
2012-10-23 22:23:25steven.dapranocreate