bx-gitea-integration/app/test.py

17 lines
711 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import re
comment_data = "Еще один \"тестовый комментарий\" [USER=28]Игорь Жабченко[/USER] добавила вывод того, сколько тмц проинвентаризировано по областям [URL=https://toinv.svs-tech.pro/stat]https://toinv.svs-tech.pro/stat[/URL]\nЧто еще надо добавить для работы с сервисом?"
bx_id = 28
mentions = re.findall(rf"\[USER=({bx_id})\]", comment_data)
print(len(mentions)>0)
comment = ''
comment_data = re.sub('"', "", comment_data)
comment_data = re.sub(
r"((\[)(.*?)(]))|\"",
"",
comment_data,
)
comment += " ".join(comment_data.split(" ")[:100])
print(comment)