13
app/helpers/remove_disclaimer.py
Normal file
13
app/helpers/remove_disclaimer.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import re
|
||||
|
||||
def remove_disclaimer(text):
|
||||
# The pattern matches the start and end of your phrase.
|
||||
# \s+ matches one or more spaces/newlines/tabs.
|
||||
# re.IGNORECASE makes it case insensitive just in case.
|
||||
|
||||
pattern = r"Caution:\s+This\s+email\s+comes\s+from\s+an\s+external\s+sender.*?\s+contact\s+your\s+IT\s+Department\.?"
|
||||
|
||||
# Substitute the found pattern with an empty string
|
||||
cleaned_text = re.sub(pattern, "", text, flags=re.IGNORECASE | re.DOTALL)
|
||||
|
||||
return cleaned_text.strip()
|
||||
Reference in New Issue
Block a user