title: regexp to allow only one space in between words
body: <p>I'm trying to write a regular expression to remove white spaces from just the beginning of the word, not after, and only a single space after the word.</p>
  
  <p>Used RegExp:</p>
  
  <pre><code>var re = new RegExp(/^([a-zA-Z0-9]+\s?)*$/);
  </code></pre>
  
  <p>Test Exapmle:</p>
  
  <pre><code>1) test[space]ing - Should be allowed 
  2) testing - Should be allowed 
  3) [space]testing - Should not be allowed 
  4) testing[space] - Should be allowed but have to trim it 
  5) testing[space][space] - should be allowed but have to trim it 
  </code></pre>
  
  <p>Only one space should be allowed. Is it possible? </p>