I’m using the PDO class but I’m triying to remove all chars except…:
function cleaner($str){
return preg_replace('/[^a-zA-Z0-9éàêïòé\,\.\']/',' ',trim($str));
}
As you can see, it’s a simple function, but it removes all chars éàêïòé
example: cleaner(‘$#$<<>-//La souris a été mangée par le chat ‘) //returns
La souris a t mang e par le chat
(The mouse has been eaten by the cat 🙂 )
Any help will be appreciate
Both the snippets worked for me, on PHP 5.3. The second regular expression is less restricted, and accepts all Unicode letters.