/ Published in: JavaScript
This function removes repeated characters after second one
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function removeDubCharacters (str) { var reg = /(.)\1{2,}/g; if(str.match(reg)) { str = str.replace(reg, '$1$1'); } return str; }