09cd6de009c6de84beecd8c388f5c96a7ddf7060 lrnassar Sun Jun 21 10:10:58 2026 -0700 Strip numbered reply prefixes (Re[2]:, Re(2):, Re^2:) in MLQ subject normalization so mail.ru-style replies match their existing ticket instead of creating a duplicate. refs #37759 refs #37758 diff --git src/utils/qa/mlqAutomate.py src/utils/qa/mlqAutomate.py index cfb6f0f5913..f5c081908fe 100755 --- src/utils/qa/mlqAutomate.py +++ src/utils/qa/mlqAutomate.py @@ -1181,30 +1181,31 @@ # Generate patterns from CONFIG to stay in sync with configured lists for addr in CONFIG['MODERATED_LISTS'] + CONFIG['UNMODERATED_LISTS']: list_name = addr.split('@')[0] # Escape the brackets for regex and remove case-insensitively pattern = re.escape(f'[{list_name}]') s = re.sub(pattern, '', s, flags=re.IGNORECASE) # Remove [External] tags added by email gateways s = re.sub(r'\[external\]', '', s, flags=re.IGNORECASE) s = re.sub(r'\bexternal:\s*', '', s, flags=re.IGNORECASE) # Remove reply/forward prefixes from anywhere # Use word boundary \b to avoid matching inside words (e.g., "Re-install") reply_forward_patterns = [ r'\bre:\s*', # Re: RE: + r'\bre\s*[\[\(\^]\s*\d+\s*[\]\)]?\s*:\s*', # Re[2]: Re(2): Re^2: (numbered replies, e.g. mail.ru) r'\bfwd?:\s*', # Fwd: FW: Fw: r'\baw:\s*', # AW: (German "Antwort") ] for pattern in reply_forward_patterns: s = re.sub(pattern, '', s, flags=re.IGNORECASE) # Strip leading punctuation and whitespace (e.g., ": Subject" -> "Subject") s = re.sub(r'^[\s:,\-]+', '', s) # Collapse multiple whitespace and strip s = ' '.join(s.split()) return s