Suppose I have a string like :
String s = "hellllooooo howwwwwww areeeeeee youuuuuuu";
I want to discard the repeated letters and want to get :
"helloo howw aree youu"
I have done the matching using ::
matches(".*([a-z])\\1{3,}.*"
But how can I replace the helloooooooo to helloo and the others ?