title: Java regex to validate a name
body: <p>To validate names that can be</p>
  
  <p>John, John Paul, etc.</p>
  
  <p>I use this regex:</p>
  
  <pre><code>String regex = "[A-Z]([a-z]+|\\s[a-z]+)";
  </code></pre>
  
  <p>but when I do:</p>
  
  <pre><code>boolean ok = Pattern.matches(regex, "John Paul");
  </code></pre>
  
  <p>the matches fail?</p>
  
  <p>Why? I want to use matches to validate the string as whole...</p>
  
  <p>Is that regex wrong?</p>