fix: _trim_to_letter_end matches full name when no profile set
When _profile is None the fallback pattern \w+ only matched the first word of a two-word sign-off (e.g. 'Alex' from 'Alex Rivera'), silently dropping the last name. Switch fallback to \w+(?:\s+\w+)? so a full first+last sign-off is preserved in no-config environments (CI, first run).
This commit is contained in:
parent
869cb2f197
commit
ab564741f4
1 changed files with 1 additions and 1 deletions
|
|
@ -221,7 +221,7 @@ def _trim_to_letter_end(text: str) -> str:
|
|||
candidate_first = (_profile.name.split()[0] if _profile else "").strip()
|
||||
pattern = (
|
||||
r'(?:Warm regards|Sincerely|Best regards|Kind regards|Thank you)[,.]?\s*\n+\s*'
|
||||
+ (re.escape(candidate_first) if candidate_first else r'\w+')
|
||||
+ (re.escape(candidate_first) if candidate_first else r'\w+(?:\s+\w+)?')
|
||||
+ r'\b'
|
||||
)
|
||||
m = re.search(pattern, text, re.IGNORECASE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue