Regex Pattern for checking the first letter of each word in a string if its Uppercase in Javascript

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


Basically I will only accept a string where each First letter of each word is Uppercase



answered 2 years ago Mohammad Awni Ali #1

I used to use this:


answered 2 years ago ahaurat #2

I'd see if your string does NOT match something like this:


answered 2 years ago Rahul Tripathi #3

You can try to use this regex:


Regex Demo

comments powered by Disqus