fork download
  1. <?php
  2. $patterns = ["are", "finite", "get", "er"];
  3. $string = "You are definitely getting better today www.get.com";
  4. $alternations = ''.implode('|', $patterns);
  5. $re = '(?<=\s)(?:are|finite|get|er)(?=\s)';
  6. $string = preg_replace('#'.$re.'#', '', $string);
  7. $string = preg_replace('#\h{2,}#', ' ', $string);
  8. echo $string;
Success #stdin #stdout 0.02s 23868KB
stdin
Standard input is empty
stdout
You definitely getting better today www.get.com