title: Regex remove repeated characters from a string by javascript
body: <p>I have found a way to remove repeated characters from a string using regular expressions.</p>
  
  <pre><code>function RemoveDuplicates() {
      var str = "aaabbbccc";
      var filtered = str.replace(/[^\w\s]|(.)\1/gi, "");  
      alert(filtered);
  }
  </code></pre>
  
  <p>Output: <code>abc</code>
  this is working fine.</p>
  
  <p>But if <code>str = "aaabbbccccabbbbcccccc"</code> then output is <code>abcabc</code>.
  Is there any way to get only unique characters or remove all duplicates one?
  Please let me know if there is any way.</p>