summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-04 04:59:22 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-04 04:59:22 (GMT)
commitb87f82f8d46c8cd0fd4ab60f9680ca51ad3345bc (patch)
tree51eb328b7ea2f5120477577d30b4c94a1198fb41 /Doc/library
parent6d26ade9205a5649431c7ea8aa1cb67b1caaf004 (diff)
downloadcpython-b87f82f8d46c8cd0fd4ab60f9680ca51ad3345bc.zip
cpython-b87f82f8d46c8cd0fd4ab60f9680ca51ad3345bc.tar.gz
cpython-b87f82f8d46c8cd0fd4ab60f9680ca51ad3345bc.tar.bz2
#16304: clarify match objects docs. Initial patch by Jan Duzinkiewicz.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/re.rst13
1 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 8397aad..26f2a38 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -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)