Hiii all,

I'm new in using Regular Expression in Java.

For example, I have String s like this:

String s = "Why John Smith and Alan Smith and Nick Gates are the same?"

How can I get sub-strings as "John Smith", "Alan Smith", "Nick Gates" - (names of people - with first upper character) from s by using regex?

I try to use regex in Java, but It totally doesn't work.

This is my code:
/*
String EXAMPLE_TEST = "Why John Smith and Alan Smith and Nick Gates are the same?";
System.out.println(EXAMPLE_TEST.matches("([A-Z]&&[a-z])"));
String[] splitString = (EXAMPLE_TEST.split("([A-Z]&&[a-z])"));
System.out.println(splitString.length);
for (String string : splitString) {
System.out.println(string);
}

*/


Please help me to have exact "regex" in this case.

Thanks all in advance!