diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 2af86d22d4598d..2392785d6c465b 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1324,6 +1324,14 @@ Match objects support the following methods and attributes: >>> m[2] # The second parenthesized subgroup. 'Newton' + Named groups are supported as well:: + + >>> m = re.match(r"(?P\w+) (?P\w+)", "Isaac Newton") + >>> m['first_name'] + 'Isaac' + >>> m['last_name'] + 'Newton' + .. versionadded:: 3.6