I would like to find all chars in a text that are typed more than 4 times and replace each of them with 4 chars of the same type found.
eg.
halllllllooooooooooooo worldddddddddd !!!!!!!!!!!!!!
should become:
halllloooo worldddd !!!!
I am trying the above code, but it seems to fail bacause it cannot understand my regex code.
$find = array("/(.)\${1}{4,}/");
$replacewith = array("$1$1$1$1");
$text = preg_replace($find , $replacewith, $text);
Anybody knows what am I missing or how to use backreference in paramter ?
Thanks a lot!