Skip to content
Snippets Groups Projects
Commit f8d5942b authored by Igor Markin's avatar Igor Markin
Browse files

Merge branch 'add-seal-word-to-plain-normalisation-regex' into 'master'

Add seal word to plain normalisation regex

See merge request !20
parents 8e5cf571 0b519c3a
No related branches found
No related tags found
1 merge request!20Add seal word to plain normalisation regex
......@@ -23,10 +23,16 @@ const patchOutlookSafelinksWrappers = (text) => {
}
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) => {
return s
.replace(/\[(image:\s)*qrcode.png]\s*<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>/g, "")
.replace(/<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>\s*\[(image: )*qrcode.png]/g, "");
.replace(/\[(image:\s)*(qrcode|seal).*?.png]\s*<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>/g, "")
.replace(/<https:\/\/.+(vereign\.com|vrgnservices\.com).*?>\s*\[(image: )*(qrcode|seal).*?.png]/g, "");
};
const cleanupHiddenCharacters = (s) => {
const removeSymbols = new RegExp(/[\u200B]+/g);
......
......@@ -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,
""
);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment