title: javascript regex white spaces before and after "sentence" need to be removed
body: <p>I need to remove all the white spaces before the first character (which is not a white space) and remove all the white spaces after the last character (which is not a white space).</p>
  
  <p>Looks like this:</p>
  
  <pre><code>'                 a boat has an anchor       '
  </code></pre>
  
  <p>Should be <code>'a boat has an anchor'</code></p>
  
  <pre><code>'   $$%&amp;@$&amp;$%&amp; lollerskates #372734§     '
  </code></pre>
  
  <p>Should be <code>'$$%&amp;@$&amp;$%&amp; lollerskates #372734§'</code></p>
  
  <p>Please ignore the single quotes, they are there to show the white space.</p>