Code: Alles auswählen
// some cleanup
$str = ' '. $str .' '; // pad that is necessary
$str = preg_replace('#\ [a-z]{1,2}\ #i', ' ', $str); // remove 2 letter words and numbers
$str = preg_replace('#[0-9\,\.:]#', '', $str); // remove numerals, including commas and dots that are part of the numeral
$str = preg_replace("/([a-z]{2,})'s/", '\\1', $str); // remove only the 's (as in mother's)
$str = str_replace('-', ' ', $str); // remove hyphens (-)
Ich habe es damit probiert, aber da passiert rein garnichts:
Code: Alles auswählen
$str = str_replace('/ä/', 'ae', $str);
$str = str_replace('/ü/', 'ue', $str);
$str = str_replace('/ö/', 'oe', $str);
$str = str_replace('/ß/', 'ss', $str);