javascript regex does not work for sentence string
<p>I am writing a function which takes string as an argument. Then if the string begins with capital letter then return true otherwise return false. But my current function only works for one word string which I want it to work for both one word and a whole sentence. How can I improve my code to achieve this? Secondly, it should not work when numbers are passed inside sentence. How can I do this?</p>

<p>Here is my code</p>

<pre><code>function takeString (str) {
var regex = /^[A-Za-z]+$/;

if (str.match(regex)) {

   if (str.charAt(0) === str.toUpperCase().charAt(0)) {
      alert('true');
      return true;
   } else {
      alert('false');
      return false;
   }

} else {
    alert('Only letters please.');
}
}

takeString('This is'); // shows Only letters please which is wrong. this should work
takeString('String); // returns true which right
takeString('string'); // returns false which is right
takeString('This is 12312321'); // shows only letters please which is right bcoz it has digits
takeString('12312312'); // show Only letters please which is right.
</code></pre>

<p>​</p>
