diff --git a/src/js/utils/str.js b/src/js/utils/str.js index bdb2c3f8a..f7495e5d9 100644 --- a/src/js/utils/str.js +++ b/src/js/utils/str.js @@ -62,10 +62,18 @@ export const titleCaseEquals = function(str1, str2) { * Whether the string contains a Hex Code */ export const containsHexCode = (string) => { - return /[a-zA-Z\040]*(&#x[0-9a-fA-F]{2,4};)[a-zA-Z\040]*/.test(string); + return /(&#x[0-9a-fA-F]{2,4};)/.test(string); }; +/** + * + * @param {string} string + * The string that will be sanitized + * + * @return {string} + * Modified string without problematic characters + */ export const sanitizeString = (string) => { - string = string.replace(/[^a-z0-9 áéíóúñü\&#;_]/gim, ''); + string = string.replace(/(?!&#x[0-9a-fA-F]{2,4};)([&\/><{}`=&])/, ''); return string.trim(); };