fork download
  1. <?php
  2.  
  3. $re = '/ ([A-Z ]+)$/m';
  4. $str = '147 Boulevard Vauban80101 ABBEVILLE
  5. 80 rue Henri Dunant94480 ABLON SUR SEINE
  6. 3465 route Eguilles13090 AIX EN PROVENCE
  7. 147A Boulevard Vauban80101 ABBEVILLE';
  8.  
  9. preg_match_all($re, $str, $matches);
  10.  
  11. // Print the entire match result
  12. var_dump($matches[1]);
  13.  
Success #stdin #stdout 0.02s 23948KB
stdin
Standard input is empty
stdout
array(4) {
  [0]=>
  string(9) "ABBEVILLE"
  [1]=>
  string(15) "ABLON SUR SEINE"
  [2]=>
  string(15) "AIX EN PROVENCE"
  [3]=>
  string(9) "ABBEVILLE"
}