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