title: Javascript - remove repeating characters when there are more than 2 repeats
body: <p>As what the title says. When there are more than 2 repeats of a letter in a string, the excess repeats are removed.</p>
  
  <p>I have the following code based off <a href="https://stackoverflow.com/questions/17973233/regular-expression-for-no-more-than-2-repeated-letters-digits">this answer</a> but it does not seem to work:</p>
  
  <pre><code>function removeRepeatingLetters (text) {
      return text.replace('^(?!.*([A-Za-z0-9])\1{2})(?=.*[a-z])(?=.*\d)[A-Za-z0-9]+$', '');
  }
  </code></pre>
  
  <p>But it does not seem to work for my test string:</p>
  
  <p>"bookkeepers! are amaazing! loooooooool"</p>
  
  <p>The output for the sample string should be:</p>
  
  <p>"bookkeepers! are amaazing! lool"</p>
  
  <p>What am I doing wrong?</p>