Commit 51c374de authored by Ezio Melotti's avatar Ezio Melotti

#16304: clarify match objects docs. Initial patch by Jan Duzinkiewicz.

parent 93d628b3
...@@ -797,9 +797,16 @@ Match Objects ...@@ -797,9 +797,16 @@ Match Objects
.. class:: MatchObject .. class:: MatchObject
Match Objects always have a boolean value of :const:`True`, so that you can test Match objects always have a boolean value of ``True``.
whether e.g. :func:`match` resulted in a match with a simple if statement. They Since :meth:`~regex.match` and :meth:`~regex.search` return ``None``
support the following methods and attributes: 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:: MatchObject.expand(template) .. method:: MatchObject.expand(template)
......
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