fork download
  1. <?php
  2.  
  3. $str = "25 Park Street 15000 My city";
  4. preg_match('/[\p{L}\p{M}]+(?:[- \'][\p{L}\p{M}]+)*$/u', $str, $matches);
  5. print_r($matches[0]);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
My city