#16304: merge with 3.3.
This commit is contained in:
commit
729eda4a8c
|
@ -824,9 +824,16 @@ attributes:
|
||||||
Match Objects
|
Match Objects
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Match objects always have a boolean value of :const:`True`. This lets you
|
Match objects always have a boolean value of ``True``.
|
||||||
use a simple if-statement to test whether a match was found. Match objects
|
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:: match.expand(template)
|
.. method:: match.expand(template)
|
||||||
|
|
Loading…
Reference in New Issue