I have following regex pattern:
line_re = re.compile(r'(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+(\S+):\s+(?P<name>.*)')
I am trying to understand what the ?P<name>
means. The expression works the same even when I remove it, i.e.:
line_re = re.compile(r'(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+(\S+):\s+(.*)')
I know that I can reference the matched patterns with match.group(3)
. What is the ?P<name>
for?