]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#16304: clarify match objects docs. Initial patch by Jan Duzinkiewicz.
authorEzio Melotti <ezio.melotti@gmail.com>
Sun, 4 Nov 2012 04:59:22 +0000 (06:59 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sun, 4 Nov 2012 04:59:22 +0000 (06:59 +0200)
Doc/library/re.rst

index 8397aad1cf932a64dba530b78a482f7f5c03596b..26f2a3824ea4a693722bc391fafa07b2215d7ff9 100644 (file)
@@ -814,9 +814,16 @@ attributes:
 Match Objects
 -------------
 
-Match objects always have a boolean value of :const:`True`.  This lets you
-use a simple if-statement to test whether a match was found.  Match objects
-support the following methods and attributes:
+Match objects always have a boolean value of ``True``.
+Since :meth:`~regex.match` and :meth:`~regex.search` return ``None``
+when there is no match, you can test whether there was a match with a simple
+``if`` statement::
+
+   match = re.search(pattern, string)
+   if match:
+       process(match)
+
+Match objects support the following methods and attributes:
 
 
 .. method:: match.expand(template)