Last active
February 26, 2020 19:54
-
-
Save seantunwin/35488a2357a9699e127500041a88e007 to your computer and use it in GitHub Desktop.
avaScript: Remove excess same character when maximum limit of same character
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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