I am trying to find a regex to verify the following:
This Is A Cat
However, to evaluate the following, to be false:
This Is A Cat
Or this is also not true:
This Is A cat (Note the 'c' is not upper case in Cat)
I am trying to use JavaScript, believing that the following should work:
/(\b[A-Z][a-z]*\s*\b)+/
Here is my logic:
- Start with the word boundary
- Matches an uppercase character
- Matches zero or lowercase characters
- Match zero or more spaces
- Match Word Border
- Repeat the above one or more times
What is wrong with my thinking?
source
share