Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d26ade commit b87f82fCopy full SHA for b87f82f
1 file changed
Doc/library/re.rst
@@ -814,9 +814,16 @@ attributes:
814
Match Objects
815
-------------
816
817
-Match objects always have a boolean value of :const:`True`. This lets you
818
-use a simple if-statement to test whether a match was found. Match objects
819
-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
820
+``if`` statement::
821
+
822
+ match = re.search(pattern, string)
823
+ if match:
824
+ process(match)
825
826
+Match objects support the following methods and attributes:
827
828
829
.. method:: match.expand(template)
0 commit comments