diff --git a/src/js/codemirror/search.js b/src/js/codemirror/search.js index 2cb598db7..d21bd4c6d 100644 --- a/src/js/codemirror/search.js +++ b/src/js/codemirror/search.js @@ -163,12 +163,12 @@ // https://github.com/uBlockOrigin/uBlock-issues/issues/658 // Modified to backslash-escape ONLY widely-used control characters. function parseString(string) { - return string.replace(/\\(.)/g, function(_, ch) { - if (ch === "n") return "\n"; - if (ch === "r") return "\r"; - if (ch === 't') return '\t'; - if (ch === '\\') return '\\'; - return _; + return string.replace(/\\[nrt\\]/g, function(match) { + if (match === "\\n") return "\n"; + if (match === "\\r") return "\r"; + if (match === '\\t') return '\t'; + if (match === '\\\\') return '\\'; + return match; }); }