diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 75ebbf11c8e47c..9fa17d1f530fe8 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1376,9 +1376,9 @@ Since :meth:`~Pattern.match` and :meth:`~Pattern.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) + m = re.search(pattern, string) + if m: + process(m) .. class:: Match