From 5c48793543c24faa62e34a283c6f1c7d1f3000d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 22 Nov 2018 22:38:17 -0500 Subject: [PATCH] handle quoted strings --- public/src/client/search.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/src/client/search.js b/public/src/client/search.js index b021c562ec..86f0a26138 100644 --- a/public/src/client/search.js +++ b/public/src/client/search.js @@ -136,9 +136,8 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo if (!searchQuery) { return; } - searchQuery = utils.escapeHTML(searchQuery); - var regexStr = searchQuery.replace(/^"/, '').replace(/"$/, '').trim().split(' ') - .join('|'); + searchQuery = utils.escapeHTML(searchQuery.replace(/^"/, '').replace(/"$/, '').trim()); + var regexStr = searchQuery.split(' ').join('|'); var regex = new RegExp('(' + regexStr + ')', 'gi'); $('.search-result-text p, .search-result-text h4').each(function () { @@ -151,7 +150,7 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo }); result.html(result.html().replace(regex, function (match, p1) { - return '' + p1 + ''; + return '' + p1 + ''; })); nested.forEach(function (nestedEl, i) {