title: Regex remove duplicate adjacent characters in javascript
body: <p>I've been struggling getting my regex function to work as intended. My goal is to iterate endlessly over a string (until no match is found) and remove all duplicate, adjacent characters. Aside from checking if 2 characters (adjacent of each other) are equal, the regex should only remove the match when one of the pair is uppercase. </p>
  
  <p>e.g. the regex should only remove 'Xx' or 'xX'.</p>
  
  <p>My current regex only removes matches where a lowercase character is followed by any uppercase character.</p>
  
  <pre><code>(.)(([a-z]{0})+[A-Z])
  </code></pre>
  
  <p>How can I implement looking for the same adjacent character and the pattern of looking for an uppercase character followed by an equal lowercase character?</p>