I am trying to come up with a regex expression for matching exactly two words separated by a space in between. For example, something like "hello there" would be valid, but something like "hello there people" would not be valid. I have tried doing this:
bool match = Regex.IsMatch("hello there", @"[\w\s]{2}");
and this:
bool match = Regex.IsMatch("hello there", @"[a-zA-Z]\s[a-zA-Z]");
but both expressions match "hello there people" too, which I don't want. What is wrong with my regex expression?
Note: "hello there" is just an example string.