fork download
  1. <?php
  2. $re = '/(\s"\S+"(?:\p{P}|\s))|"/';
  3. $str = 'this i"s a "test" word i"s"s. NOt a "test".';
  4. $subst = '$1';
  5.  
  6. $result = preg_replace($re, $subst, $str);
  7.  
  8. echo $result;
Success #stdin #stdout 0.02s 23736KB
stdin
Standard input is empty
stdout
this is a "test" word iss. NOt a "test".