summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-04 05:00:04 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-04 05:00:04 (GMT)
commit729eda4a8c345bdfd7092dea155df22962cd0c9b (patch)
tree608d3ed59c74404fb04d99b1910118239c2a3c45
parent5e3943317d2442b82ac56eafe29cc7d76ac4f0d2 (diff)
parent7ce22d19403873d590bdda78b721e15510132d16 (diff)
downloadcpython-729eda4a8c345bdfd7092dea155df22962cd0c9b.zip
cpython-729eda4a8c345bdfd7092dea155df22962cd0c9b.tar.gz
cpython-729eda4a8c345bdfd7092dea155df22962cd0c9b.tar.bz2
#16304: merge with 3.3.
-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 07623c9..b0cb870 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -824,9 +824,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)