fork download
  1. <?php
  2.  
  3. $contents = '1234 FIRSTNAME LASTNAME M 4321
  4. 1345 LASTNAME F 4621
  5. 8223 FIRSTNAME LASTNAME M 4256';
  6. if (preg_match_all('~\b[A-Z]{2,}(?:\h+[A-Z]{2,})?\b~', $contents, $result)) {
  7. print_r($result[0]);
  8. }
Success #stdin #stdout 0.02s 23712KB
stdin
Standard input is empty
stdout
Array
(
    [0] => FIRSTNAME   LASTNAME
    [1] => LASTNAME
    [2] => FIRSTNAME   LASTNAME
)