[Solved] C# how to check if a string contains 3 times the same letters in a row [closed]


Sometimes (rarely) regexes are the response to the question, especially if the question is like this.

bool ism1 = Regex.IsMatch("AABAC", @"(.)\1\1"); // false
bool ism2 = Regex.IsMatch("AAABC", @"(.)\1\1"); // true

Matches any character (.) followed by the first match (\1) twice.

0

solved C# how to check if a string contains 3 times the same letters in a row [closed]