Created
August 23, 2018 19:05
-
-
Save erdembayar/33e22f3d65f0226feb9b19c8624c0138 to your computer and use it in GitHub Desktop.
This file contains 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
int numAllow = 3; | |
var str = new String('o', numAllow); | |
var innerPattern = new String('o', numAllow + 1); | |
var pattern = $"{innerPattern}+"; | |
var strToChange = "AAAooooooooAAAooooAAAAAAoooAAAAAooAAAAooooooooooooooooooooooooAAAAA"; | |
var output = Regex.Replace(strToChange, pattern, str); | |
Console.WriteLine(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment