Skip to content

Commit c06653f

Browse files
committed
Updated taxonomy filtering REGEX and string replacements for international character support
1 parent 31ee609 commit c06653f

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@
985985

986986
if (typeof data[k] !== 'undefined') {
987987
for (var l = 0; l < filterTests.length; l++) {
988-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''));
988+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''));
989989
}
990990
}
991991

@@ -995,7 +995,7 @@
995995
}
996996
// Inclusive filtering
997997
else {
998-
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '')))) {
998+
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '')))) {
999999
filterTest = false;
10001000
}
10011001
}
@@ -2800,7 +2800,7 @@
28002800
if (!taxFilters[k]) {
28012801
taxFilters[k] = [];
28022802
}
2803-
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '\\b)';
2803+
taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '');
28042804
}
28052805
}
28062806
}

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ filtering.
3939

4040
* Added featuredDistance setting to restrict featured locations by a specified distance (number value should be used).
4141
* Updated bundled version of Handlebars to v4.5.1 due to security issue.
42+
* Updated taxonomy filtering REGEX and string replacements for international character support.
4243

4344
### Version 3.0.1
4445

src/js/jquery.storelocator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@
981981

982982
if (typeof data[k] !== 'undefined') {
983983
for (var l = 0; l < filterTests.length; l++) {
984-
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''));
984+
exclusiveTest[l] = new RegExp(filterTests[l], 'i').test(data[k].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, ''));
985985
}
986986
}
987987

@@ -991,7 +991,7 @@
991991
}
992992
// Inclusive filtering
993993
else {
994-
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '')))) {
994+
if (typeof data[k] === 'undefined' || !(new RegExp(filters[k].join(''), 'i').test(data[k].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '')))) {
995995
filterTest = false;
996996
}
997997
}
@@ -2796,7 +2796,7 @@
27962796
if (!taxFilters[k]) {
27972797
taxFilters[k] = [];
27982798
}
2799-
taxFilters[k][z] = '(?=.*\\b' + filters[k][z].replace(/([^\x00-\x7F]|[.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '') + '\\b)';
2799+
taxFilters[k][z] = '(?:^|\\s)' + filters[k][z].replace(/([.*+?^=!:${}()|\[\]\/\\]|&\s+)/g, '');
28002800
}
28012801
}
28022802
}

0 commit comments

Comments
 (0)