title: Javascript Regular Expression Remove Spaces
body: <p>So i'm writing a tiny little plugin for JQuery to remove spaces from a string. <a href="http://jsfiddle.net/rlemon/ge59E/" rel="noreferrer">see here</a></p>
  
  <pre><code>(function($) {
      $.stripSpaces = function(str) {
          var reg = new RegExp("[ ]+","g");
          return str.replace(reg,"");
      }
  })(jQuery);
  </code></pre>
  
  <p>my regular expression is currently <code>[ ]+</code> to collect all spaces. 
  This works.. however It doesn't leave a good taste in my mouth.. 
  I also tried <code>[\s]+</code> and <code>[\W]+</code> but neither worked.. </p>
  
  <p>There has to be a better (more concise) way of searching for only spaces. </p>