I’m trying to check validation of string that should describe a street’s name.
The template is: number of words start with capital letter, and number with 1 through 4 digits.
Example: Name Of Street 101
I tried this:
Regex stRegex = new Regex(@"^[A-Z][a-z]+ [1-9]+$");
But it seems to not working.
What is the pattern should be to make it work?
You only check for a single word, and you do not allow zeros in the number. Maybe something more like this?
However your template is a bit restrictive, I think. What about
O'Sullivan Street? And you might also want to allow multiple spaces (by adding another+right after the space).