Reputation: 375
for example my string is Foo Bar. this string should match the pattern.
if the string is Foo bar. the string should not match.
if the string is Foo Bar Foobar the string should match
if the string is Foo. it should also match.
so far I only have this pattern
(^[A-Z]{1}.*(\s)?$)+
Basically I will only accept a string where each First letter of each word is Uppercase
Upvotes: 8
Views: 28734
Reputation: 4255
I'd see if your string does NOT match something like this:
/\b[a-z]/
Upvotes: 10