I have a string like this :
$somestring= "10, Albalala STREET 11 (768454)";
the for mat could change a little bit like :
$somestring= "10, Albalala STREET 11 (S) 768454 ";
or
$somestring= "10, Albalala STREET 11 (S) ( 768454 )";
I want to use regex in php to get that 6 digits number (which is the postal code).
$regex_pattern = "/^\d{6}$/";
preg_match_all($regex_pattern,$somestring,$matches);
print_r("postalcode: " . $matches);//
The result I got is :
postalcode: Array
not a number 768454 Do you have any idea why ?