Ich habe mir das nun so zurecht gelegt, scheint seinen Dienst zu erfüllen.
PHP-Code:function stripAscii($text)
{
// First, remove all "weird" characters.
$text = preg_replace("/[^a-zA-Z0-9öäüÖÄÜß\\-_?!&[\\]().,;:+=#*~@\\/\\\\'\"><\\s]/", "", $text);
//$text = preg_replace("cpN/cRo", "", $text);
//$text = preg_replace("cpN!", "", $text);
//$text = str_replace (chr(20), " ", $text);
while ($text != $oldtext) {
$oldtext = $text;
// Remove all repeating umlauts
$text = preg_replace("/[öäüÖÄÜß]{2,}/", "", $text);
// Remove all "free" umlauts, not enclosed by other word chars
$text = preg_replace("/(^|\\s)[öäüÖÄÜß]+(\\s|$)/sm", "", $text);
}
$text = preg_replace("/ {2,}/", "", $text);
$text = preg_replace("#[\r\n]{4,}#", "\r\n\r\n", $text);
$text = preg_replace('/([^\x21-\x7E\xA9\xAE\r\n\s])+/', '', $text);
$text = nl2br($text);
$text = preg_replace('/\s{2,}/', '', $text);
//$text = preg_replace('/(\<br \/\>){3,}/', '<br /><br />', $text);
$text = trim($text);
// Remove trailing spaces at end of line
// $text = preg_replace("/([\\t ]+)(\\s$)/m", "\r2", $text);
//$text = preg_replace("/\\r1{2,}/", "", $text);
//$text = preg_replace('#(?<!\r\n)\r\n(?!\r\n)#', ' ', $text);
return $text;
}



THEMENSTARTER

Zitieren