From 17745ebc93e128fffee853c1cd2c392ff1c38049 Mon Sep 17 00:00:00 2001 From: SandyDatatables Date: Thu, 12 Aug 2021 12:13:42 +0000 Subject: [PATCH] fix: Split words on whitespace instead of non letters or numbers Jira Issue DD-2077 --- features/fuzzySearch/dataTables.fuzzySearch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/fuzzySearch/dataTables.fuzzySearch.js b/features/fuzzySearch/dataTables.fuzzySearch.js index a7660a2..65432bf 100644 --- a/features/fuzzySearch/dataTables.fuzzySearch.js +++ b/features/fuzzySearch/dataTables.fuzzySearch.js @@ -82,7 +82,7 @@ var threshold = initial.threshold !== undefined ? initial.threshold : 0.5; // Split the searchVal into individual words. - var splitSearch = searchVal.split(/[^(a-z|A-Z|0-9)]/g); + var splitSearch = searchVal.split(/ /g); // Array to keep scores in var highestCollated = []; @@ -105,7 +105,7 @@ data[i] = data[i].toLowerCase(); // Split the data into individual words - var splitData = data[i].split(/[^(a-z|A-Z|0-9)]/g); + var splitData = data[i].split(/ /g); // Remove any empty words or spaces for (var y = 0; y < splitData.length; y++){