I want to replaceAll strings like:
"aaaa"
"zzzzzzz"
"----------"
"TTTTTT"
"...."
String contains only one char, but > 3 times.
I use Java. I can replace a specific char (like "a") with more than 3 times, but don't know how to do this with any char:
str = str.replaceAll("^[a]{4,}$", "");
Any idea? If this can't be done in regex, how would you do it?
"(?s)^(.)\\1{3,}$".