fork download
  1. <?php
  2. $ptn = "/[IE][NS][FT][JP]/";
  3. $str = "ISTJ, ESTP,ENTP but not EJPT";
  4. preg_match_all($ptn, $str, $matches);
  5. print_r($matches);
  6. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => ISTJ
            [1] => ESTP
            [2] => ENTP
        )

)