14 lines
299 B
Python
14 lines
299 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import re
|
||
|
|
|
||
|
|
SLACK_MENTION_STRIP_PATTERN = re.compile(r"<@[^>\s]+>")
|
||
|
|
|
||
|
|
|
||
|
|
def strip_mentions(text: str) -> str:
|
||
|
|
return SLACK_MENTION_STRIP_PATTERN.sub("", text).strip()
|
||
|
|
|
||
|
|
|
||
|
|
def extract_mentions(text: str) -> list[str]:
|
||
|
|
return re.findall(r"<@([A-Z0-9]+)>", text)
|