From c61c53d9ec7decbb1cfec0e2c29eae01cb97d3f3 Mon Sep 17 00:00:00 2001 From: Adam Janovsky Date: Tue, 23 Nov 2021 18:29:13 +0100 Subject: fix string sanitization during cpe matching --- sec_certs/model/cpe_matching.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sec_certs/model/cpe_matching.py b/sec_certs/model/cpe_matching.py index b8c28bcf..ac96d1de 100644 --- a/sec_certs/model/cpe_matching.py +++ b/sec_certs/model/cpe_matching.py @@ -131,8 +131,7 @@ class CPEClassifier(BaseEstimator): @staticmethod def _replace_special_chars_with_space(string: str) -> str: - replace_non_letter_non_numbers_with_space = re.compile(r"(?ui)\W") - return replace_non_letter_non_numbers_with_space.sub(' ', string) + return re.sub(r'[^a-zA-Z0-9 \n\.]', ' ', string) @staticmethod def _discard_trademark_symbols(string: str) -> str: -- cgit v1.3.1