var str = "AAACDEAAAABBBUUDD";var res = str.replace( /(.)\1{2,}/g, "<b>$&</b>");print( res );
Standard input is empty
<b>AAA</b>CDE<b>AAAA</b><b>BBB</b>UUDD
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!