<?php
//$regexps = array('/(\S*?)([acekopxyABCEHKMOPTXY])(\S*?)/', '/(\S*?)([аекморстухьАВЕКМНОРСТУХ])(\S*?)/u');
// ^-----Регулярка для выделения ВСЕХ опечаток в слове
$regexps = array ( '/(\S*?)([acekopxyABCEHKMOPTXY])(\S*)/' , '/(\S*?)([аекморстухьАВЕКМНОРСТУХ])(\S*)/u' ) ; // ^-----Регулярка для выделения ПЕРВОЙ опечатки в слове
$text = 'Пocтaвкa мяco гoвядины, бecкостнoe для нужд государственного
бюджетного учреждения здравоохранения Республики Башкортостан Инфекционная
клиническая больница № 4 города Уфа ' ;
$replacement = '$1[$2]$3' ;
// ^-----Для выделения опечаток
//$replacement = '"$1".$letterReplacements["$2"]."$3"';
// ^-----Для замены опечаток
$langRegexps = array ( '/[бвгджзилнпфцчшщъыьэюяБГДЖЗИЙЛПФЦЧШЩЫЭЮЯ]/u' , '/[bdfghijlmnqrstuvwzDFGIJLNQRSUVWZ]/' ) ;
$letterReplacements = array ( 'а' => 'a' ,
'е' => 'e' ,
'к' => 'k' ,
'м' => 'm' ,
'о' => 'o' ,
'р' => 'p' ,
'с' => 'c' ,
'т' => 't' ,
'у' => 'y' ,
'х' => 'x' ,
'ь' => 'b' ,
'А' => 'A' ,
'В' => 'B' ,
'Е' => 'E' ,
'К' => 'K' ,
'М' => 'M' ,
'Н' => 'H' ,
'О' => 'O' ,
'Р' => 'P' ,
'С' => 'C' ,
'Т' => 'T' ,
'У' => 'Y' ,
'Х' => 'X' ) ;
//$text = preg_replace_callback($regexps[LANG_RUS], $replacement, $text);
// ^-----Для замены опечаток
$text = preg_replace ( $regexps [ LANG_RUS
] , $replacement , $text ) ; // ^-----Для выделения опечаток
} elseif ( preg_match ( $langRegexps [ LANG_ENG
] , $text ) ) { //$text = preg_replace_callback($regexps[LANG_ENG], $replacement, $text);
// ^----- Для замены опечаток
$text = preg_replace ( $regexps [ LANG_ENG
] , $replacement , $text ) ; // ^-----Для выделения опечаток
}
echo "$text " ;
?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