title: javascript replace dash char using regex or otherwise
body: <p>I have this:</p>
  
  <pre><code>11111-22222-333---444---55--5566--6-----7-
  </code></pre>
  
  <p>I am using this code:</p>
  
  <pre><code>overlaps.replace(/-{2}/g, '-');
  </code></pre>
  
  <p>however it does not work, want i am looking for is that multiple instances of <code>-</code> should be replaced with one <code>-</code> and ending dash should be removed if any.</p>
  
  <p>Can anybody tell what i am doing wrong ?</p>