update escape regex

This commit is contained in:
Mystikfluu 2022-07-03 12:12:30 +02:00
parent ad0d9b1215
commit c55bf8fb8c

View File

@ -1,7 +1,7 @@
const {replace} = '';
const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
const ca = /[&<>'"]/g;
const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|\\\\|`);/g;
const ca = /[&<>'"\\\\`]/g;
const esca = {
'&': '&amp;',
@ -9,8 +9,8 @@ const esca = {
'>': '&gt;',
"'": '&#39;',
'"': '&quot;',
'\\': '\\\\',
'`': '\\`'
'`': '\\`',
'\\': '\\\\'
};
const pe = m => esca[m];
@ -29,8 +29,8 @@ const unes = {
'&#39;': "'",
'&quot;': '"',
'&#34;': '"',
'\\\\': '\\',
'\\`': '`'
'\\`': '`',
'\\\\': '\\'
};
const cape = m => unes[m];