Can someone give me a Java regex to replace the following.
If I have a word like this "Cooooool", I need to convert this to "Coool" with 3 o's. So that I can distinguish it with the normal word "cool".
Another ex: "happyyyyyy" should be "happyyy"
replaceAll("(.)\\1+","$1"))
I tried this but it removes all the repeating characters leaving only one.
$1
three times? – G_hi3 Aug 18 '15 at 11:27\\1
to your pattern – G_hi3 Aug 18 '15 at 11:32