diff --git a/etc/report_generator.py b/etc/report_generator.py index b5974ab..30ed0ba 100644 --- a/etc/report_generator.py +++ b/etc/report_generator.py @@ -151,7 +151,10 @@ def parse_log_file(file_path): log_data['shameList'].insert(0, line) # get the user who sent the message - user_match = re.search(r'From: (\w+)', line) + if 'To: ' in line: + user_match = re.search(r"From: '([^']+)'(?: To:|$)", line) + else: + user_match = re.search(r"From: (.+)$", line) if user_match: log_data['unique_users'].add(user_match.group(1)) diff --git a/etc/report_generator5.py b/etc/report_generator5.py index 43440a1..ad8f1b4 100644 --- a/etc/report_generator5.py +++ b/etc/report_generator5.py @@ -160,7 +160,10 @@ def parse_log_file(file_path): log_data['shameList'].insert(0, line) # get the user who sent the message - user_match = re.search(r'From: (\w+)', line) + if 'To: ' in line: + user_match = re.search(r"From: '([^']+)'(?: To:|$)", line) + else: + user_match = re.search(r"From: (.+)$", line) if user_match: log_data['unique_users'].add(user_match.group(1))