I have a lot of sentences that need to be cleaned up from all the special characters and punctuations (I want to keep just the letters and numbers and spaces), for example:
$string = "TB Avrupa ve Türkiye'nin en iyi oranlari ile Lider Bahis Sitesi!!";
$final_title = preg_replace('/[^a-z]+/i', '', $string);
This remove everything (with spaces) I need to keep spaces can i add anything to the previous line to achieve this ??
Expected output :
TB Avrupa ve Türkiyenin en iyi oranlari ile Lider Bahis Sitesi
I want to keep just the letters and numbers and spaces
You can use this regex to remove everything other than english letters, digits and spaces:
preg_replace('/[^a-z\d ]+/i', '', $string);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With