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 3637425 commit 48647d0Copy full SHA for 48647d0
Doc/library/re.rst
@@ -1324,6 +1324,14 @@ Match objects support the following methods and attributes:
1324
>>> m[2] # The second parenthesized subgroup.
1325
'Newton'
1326
1327
+ Named groups are supported as well::
1328
+
1329
+ >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Isaac Newton")
1330
+ >>> m['first_name']
1331
+ 'Isaac'
1332
+ >>> m['last_name']
1333
+ 'Newton'
1334
1335
.. versionadded:: 3.6
1336
1337
0 commit comments