fork download
  1. <?php
  2. $text="Привет,мир!";
  3. $checkProbel='/(,\S)|(\.\S)|(\?\S)|(!\S)/u';
  4. $matches=array();
  5. if (preg_match($checkProbel,$text,$matches)){
  6. echo "Yes \n";
  7. var_dump($matches);
  8. }else{
  9. echo "No";
  10. };
  11. ?>
Success #stdin #stdout 0.02s 24144KB
stdin
Standard input is empty
stdout
Yes 
array(2) {
  [0]=>
  string(3) ",м"
  [1]=>
  string(3) ",м"
}