I have strings like this :
Aaaaaaaaa
I want to stop repeating just to 3 times, but not break the lowercase/uppercase, like this :
Aaa
My regex breaks the lowercase/uppercase :
$patternReplace = '/(.)\1{3,}/iu';
$chaine = preg_replace($patternReplace, '$1$1$1', $chaine, -1 );
Result :
AAA
I want to get :
Aaa
thanx for help