Skip to content

Commit

Permalink
fix: special chars in showSearchBox (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdisolhan authored Aug 3, 2023
1 parent 56c543b commit dd313a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/vue-tel-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,13 @@ export default {
if (!this.dropdownOptions.showSearchBox) {
return countriesList;
}
const userInput = this.searchQuery;
const cleanInput = userInput.replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]/g, '');
return countriesList.filter(
(c) => (new RegExp(this.searchQuery, 'i')).test(c.name)
|| (new RegExp(this.searchQuery, 'i')).test(c.iso2)
|| (new RegExp(this.searchQuery, 'i')).test(c.dialCode),
(c) => (new RegExp(cleanInput, 'i')).test(c.name)
|| (new RegExp(cleanInput, 'i')).test(c.iso2)
|| (new RegExp(cleanInput, 'i')).test(c.dialCode),
);
},
phoneObject() {
Expand Down

0 comments on commit dd313a1

Please sign in to comment.