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.
2 parents d081fbb + b87f82f commit 7ce22d1Copy full SHA for 7ce22d1
1 file changed
Doc/library/re.rst
@@ -824,9 +824,16 @@ attributes:
824
Match Objects
825
-------------
826
827
-Match objects always have a boolean value of :const:`True`. This lets you
828
-use a simple if-statement to test whether a match was found. Match objects
829
-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
830
+``if`` statement::
831
+
832
+ match = re.search(pattern, string)
833
+ if match:
834
+ process(match)
835
836
+Match objects support the following methods and attributes:
837
838
839
.. method:: match.expand(template)
0 commit comments