In many case you might want to replace duplicate characters when there are more than 2 repeats of a letter in a string.

Regex for remove consecutive repeating characters

str.replace( /(.)\1{2,}/g, '$1$1' )

Pretty small but useful hack :D