'[ERROR] 2026-07-28 payment failed'. Write parse_log(line) using one regex with named groups level, date, message, returning them as a dict, or None when the line doesn't match.parse_log('[WARN] 2026-01-05 disk low'){'level': 'WARN', 'date': '2026-01-05', 'message': 'disk low'}Three named groups captured the pieces.
r'\[(?P<level>\w+)\] (?P<date>\d{4}-\d{2}-\d{2}) (?P<message>.+)'.
m.groupdict() converts to a dict.