I have a private function in PHP that takes a given URL string and just leave the Alpha or numeric and certain punctuation left. I need the stripping of string due to having it match against ElasticSearch and ElasticSearch doesn't take it too kindly for special characters when it comes to exact match.The following function so far is working fine.protected function stripSpecialCharater($string){    $string = iconv(Windows-1252,UTF-8,urldecode($string));    $string = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string);    return preg_replace('/[^a-zA-Z0-9&-\s]/', '', $string);}Can it be better? is there a lib that does this better? I've used Laravel Validation service where you can specify alpha_dash but this is not for validation but rather I need the left over to see if there is a match to the Database Storage for a search.
Efficient Strip Special Characters
php;strings;regex