So i’m trying to preg_match an address in PHP.
It should be letters SPACE numbers and not numbers SPACE letters.
So, like this: Myplace 16.
The length of the numbers and letters doesn’t matter, but they can’t be mixed together.
I already tried this one but this one doens’t check spaces:
if(preg_match("/^[0-9a-zA-Z_]{5,}$/", $adres) === 0)
{
echo 'Address is wrong';
}
Thanks in advance!
The pattern you showed doesn’t correspond at all to what you’re trying to do. For your purpose, you would do something like
This checks for at least one letter at the beginning of the string followed by 1 or more spaces followed by 1 or more digits, at which point the string must end.
Unless, of course, I misunderstand what you are trying to achieve…