fork download
  1. <?php
  2.  
  3. $input = 'Lorem Ipsum is simply dummy text of the printing industry.';
  4. $except = array('and', 'the', 'text', 'simply');
  5. if (preg_match_all('/\b(?!(?:' . implode('|', $except) . ')\b)\w{3,}/', $input, $matches)) {
  6. print_r($matches[0]);
  7. }
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Lorem
    [1] => Ipsum
    [2] => dummy
    [3] => printing
    [4] => industry
)