fork(1) download
  1. <?php
  2. //Поиск разных ошибок в тексте
  3. $text = ',жызнь сдесь зделал зделан но а';
  4. $matches = array();
  5.  
  6. $error1 = '/([,;!?:][\\S])/ui';
  7. $error2 = '/жы|шы/ui';
  8. $error3 = '/координально|сдесь|здела(л|ю|н)/ui';
  9. $error4 = '/[^,\\S](а|но)/ui';
  10.  
  11. echo "Ваши ощибки: \n";
  12.  
  13. if (preg_match_all($error1, $text)) {
  14. echo preg_replace($error1, '[$0]', $text) . "\n";
  15. }
  16. if (preg_match_all($error2, $text)) {
  17. echo preg_replace($error2, '[$0]', $text) . "\n";
  18. }
  19. if (preg_match_all($error3, $text)) {
  20. echo preg_replace($error3, '[$0]', $text) . "\n";
  21. }
  22. if (preg_match_all($error4, $text)) {
  23. echo preg_replace($error4, '[$0]', $text) . "\n";
  24. }
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Ваши ощибки: 
[,ж]ызнь сдесь зделал зделан но а
,[жы]знь сдесь зделал зделан но а
,жызнь [сдесь] [зделал] [зделан] но а
,жызнь сдесь зделал зделан[ но][ а]