<?php
$text = "Пocтaвкa мяco гoвядины, бecкостнoe для нужд государственного бюджетного учреждения здравоохранения Республики Башкортостан Инфекционная клиническая больница № 4 города Уфа." ;
$regexp = '/[а-яё]*[a-z][а-яё]*/ui' ;
'/A/u' => '[А]' ,
'/a/u' => '[а]' ,
'/B/u' => '[В]' ,
'/C/u' => '[С]' ,
'/c/u' => '[с]' ,
'/T/u' => '[Т]' ,
'/O/u' => '[О]' ,
'/o/u' => '[о]' ,
'/P/u' => '[Р]' ,
'/p/u' => '[р]' ,
'/E/u' => '[Е]' ,
'/e/u' => '[е]' ,
'/H/u' => '[Н]' ,
'/K/u' => '[К]' ,
'/k/u' => '[к]' ,
'/M/u' => '[М]' ,
'/y/u' => '[у]'
) ;
$regexpSegmentClean = array ( '/\\[А\\]/u' => 'А' ,
'/\\[а\\]/u' => 'а' ,
'/\\[В\\]/u' => 'В' ,
'/\\[С\\]/u' => 'С' ,
'/\\[с\\]/u' => 'с' ,
'/\\[Т\\]/u' => 'Т' ,
'/\\[О\\]/u' => 'О' ,
'/\\[о\\]/u' => 'о' ,
'/\\[Р\\]/u' => 'Р' ,
'/\\[р\\]/u' => 'р' ,
'/\\[Е\\]/u' => 'Е' ,
'/\\[е\\]/u' => 'е' ,
'/\\[Н\\]/u' => 'Н' ,
'/\\[К\\]/u' => 'К' ,
'/\\[к\\]/u' => 'к' ,
'/\\[М\\]/u' => 'М' ,
'/\\[у\\]/u' => 'у'
) ;
foreach ( $regexpSegment as $keys => $values ) {
}
$textClean = $text ;
foreach ( $regexpSegmentClean as $dirtyCyrillic => $cleanCyrillic ) {
$textClean = preg_replace ( $dirtyCyrillic , $cleanCyrillic , $textClean ) ; }
echo "Текст с \" опечатками\" :\n {$text} \n " ;
echo "Текст с исправленными \" опечатками\" :\n {$textClean} \n " ;
} else {
echo "\" Опечаток\" не найдено." ;
}
?>
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcp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