mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 09:07:18 +01:00
optimize regex
This commit is contained in:
parent
073c3c8fed
commit
d132eba143
2 changed files with 3 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue