From b555b9ce4e55368dbfe4f8fea71a6fc33d040ad0 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 6 Jun 2022 18:16:39 -0400 Subject: [PATCH] improved voice.py uri remover --- utils/voice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/voice.py b/utils/voice.py index e6f3989..13633da 100644 --- a/utils/voice.py +++ b/utils/voice.py @@ -10,7 +10,8 @@ def sanitize_text(text): """ # remove any urls from the text - regex_urls = r"((http|https)://[^\s]+)" + regex_urls = r'((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z]){2,6}([a-zA-Z0-9\.\&\/\?\:@\-_=#])*' + result = re.sub(regex_urls, " ", text) # note: not removing apostrophes