title: Remove consecutive characters of certain type with RegExp in JS
body: <p>I need a regex for removing specific consecutive characters.</p>
  
  <p>For example. I can use </p>
  
  <pre><code>var filtered = oldString.replace(/[^[\w]\s]|(.)(?=\1)/gi, ""); 
  </code></pre>
  
  <p>If I need to get rid of any consecutive characters.</p>
  
  <p>And I can use.</p>
  
  <pre><code>var filtered = oldString.replace(/[^[\w]\s]|(,|;|\s)(?=\1)/gi, ""); 
  </code></pre>
  
  <p>If I need to get rid of consecutive commas, semi-colons and space characters.</p>
  
  <p>But what I exactly need is to make string like <code>;,</code> look like <code>;</code>.</p>
  
  <p>And string like <code>,,,,,  ;</code> look like single comma <code>,</code>.</p>
  
  <p>So I need to get rid of any consecutive chars of some type.</p>
  
  <p>How I am supposed to do that?</p>