title: Regex for multiple words split by spaces
body: <p>I am at the point where I am banging my head against my desk, to the amusement of my colleagues.  I currently have the following regex</p>
  
  <pre><code>(^[\w](( \w+)|(\w*))*[\w]$)|(^\w$)
  </code></pre>
  
  <p>What I want it to do is match any string which contains only alphanumeric characters, no leading or trailing whitespace and no more than one space between words.</p>
  
  <p>A word in this case is defined as one or more alphanumeric characters.</p>
  
  <p>This matches most of what I want, however from testing it also thinks the second word onwards must be of 2 characters or more in length.</p>
  
  <p><strong>Tests:</strong></p>
  
  <pre><code>ABC - Pass
  Type 1 - Fail
  Type A - Fail
  Hello A - Fail
  Hello Wo - Pass
  H A B - Fail
  H AB - Pass
  AB H - Fail
  </code></pre>
  
  <p>Any ideas where I'm going wrong?</p>