Skip to content

Instantly share code, notes, and snippets.

@seantunwin
Last active February 26, 2020 19:54
Show Gist options
  • Save seantunwin/35488a2357a9699e127500041a88e007 to your computer and use it in GitHub Desktop.
Save seantunwin/35488a2357a9699e127500041a88e007 to your computer and use it in GitHub Desktop.
avaScript: Remove excess same character when maximum limit of same character
/* Limit character to repeat 3 times maximum */
'ffdttttyyqqqqqqq'.replace(/(.)\1{3,}/g, '$1$1$1');
// 'ffdtttyyqqq'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment