fix(python/robomp): updated mention regex to correctly reject suffixes

- Updated the mention extraction regex to prevent partial matching when a suffix follows the `[bot]` identifier.
- Added a regression test to ensure that invalid extended suffixes are correctly rejected.
This commit is contained in:
can1357
2026-06-21 19:26:42 +02:00
parent 24a0c8428a
commit 69d0ac4dd3
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ def extract_mention(body: str | None, bot_login: str) -> str | None:
if not login:
return None
pattern = re.compile(
rf"(?<![A-Za-z0-9_-])@{re.escape(login)}(?:\[bot\])?(?![A-Za-z0-9_-])",
rf"(?<![A-Za-z0-9_-])@{re.escape(login)}(?:\[bot\](?![A-Za-z0-9_-])|(?![A-Za-z0-9_\[-]))",
re.IGNORECASE,
)
if not pattern.search(body):