fork(1) download
  1. <?php
  2.  
  3. $epText = "this is for text |XYZ and |XYZ and XYZ";
  4. $find = '|XYZ';
  5. $replace = "\n";
  6. $epFormatedText = preg_replace(
  7. "/(?<!\\w)" . preg_quote($find) . "(?!\\w)/",
  8. $replace,
  9. $epText
  10. );
  11. echo $epFormatedText;
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
this is for text 
 and 
 and XYZ