diff --git a/src/Widget/RegionService.php b/src/Widget/RegionService.php index ee9894b4..8ed871cc 100644 --- a/src/Widget/RegionService.php +++ b/src/Widget/RegionService.php @@ -47,17 +47,18 @@ public function getAutocompletResults($searchString, $language = 'nl') $translatedRegion = $region->name; } } + $compareString = strtolower($translatedRegion); // This is done to find cities & towns with short names which also match lots of other cities & towns // e.g., Zele or Egem - if (strpos(strtolower($translatedRegion), $searchString) === 0) { + if (strpos($compareString, $searchString) === 0) { $matches[$region->key] = $translatedRegion; } // This is done to add the submunicipalities when searching for a municipality. - if (strpos(strtolower($translatedRegion), '(' . $searchString) !== false) { + if (strpos($compareString, '(' . $searchString) !== false) { $matches[$region->key] = $translatedRegion; } // This is done to add informal municipality names without prefixes like Saint - if (strpos(strtolower($translatedRegion), '-' . $searchString) !== false) { + if (strpos($compareString, '-' . $searchString) !== false) { $matches[$region->key] = $translatedRegion; } }