mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-16 21:55:37 -05:00
optimize regex
This commit is contained in:
@@ -105,9 +105,8 @@ class MailDocumentParser(DocumentParser):
|
||||
|
||||
def parse(self, document_path, mime_type, file_name=None):
|
||||
def strip_text(text: str):
|
||||
text = re.sub("\t", " ", text)
|
||||
text = re.sub(" +", " ", text)
|
||||
text = re.sub("(\n *)+", "\n", text)
|
||||
text = re.sub(r"\s+", " ", text)
|
||||
text = re.sub(r"(\n *)+", "\n", text)
|
||||
return text.strip()
|
||||
|
||||
mail = self.get_parsed(document_path)
|
||||
|
Reference in New Issue
Block a user