From 97c22635c15b2fa6808b0da16c4e5415c9dc833b Mon Sep 17 00:00:00 2001 From: igor <igor.markin@vereign.com> Date: Tue, 9 Feb 2021 09:59:31 +0300 Subject: [PATCH] Update regex --- src/PlainNormalizer/PlainNormalizer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/PlainNormalizer/PlainNormalizer.ts b/src/PlainNormalizer/PlainNormalizer.ts index a30c84d..8231074 100644 --- a/src/PlainNormalizer/PlainNormalizer.ts +++ b/src/PlainNormalizer/PlainNormalizer.ts @@ -28,14 +28,20 @@ const patchOutlookSafelinksWrappers = (text: string) => { return text; }; +/** + * Function removes seal from the plain text. + * Function has to support the next possible file names of the seal: + * qrcode.png, qrcode-xxx.png, seal-xxx.png + * @param s + */ const removeQRCodes = (s: string): string => { return s .replace( - /\[(image:\s)*qrcode.png]\s*<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>/g, + /\[(image:\s)*(qrcode|seal).*?.png]\s*<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>/g, "" ) .replace( - /<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>\s*\[(image: )*qrcode.png]/g, + /<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>\s*\[(image: )*(qrcode|seal).*?.png]/g, "" ); }; -- GitLab