Code :

$words = preg_replace("|[^\d\w ]+|i","",$words); 

The problem is that he removes not only punishment marks, but also Cyrillic !!!

    2 answers 2

    Use it. works

     $words = preg_replace("|[^\d\wа-яА-Я ]+|i","",$words); 
    • REALLY WORKS1 !!! THANK!!! - mememaestro1338

    Or use the u modifier and pass the input string to UTF-8,

     $words = preg_replace("|[^\d\w ]|iu","",$words); 

    either look for the punctuation marks and delete them

     $words = preg_replace("|[,.:;]+|","",$words); 

    or list in the template and Cyrillic

     $words = preg_replace("|[^\d\wа-я ]|i","",$words); 
    • thank you too - mememaestro1338