in reply to More efficient way to truncate long strings of the same character
This one would be faster
$text =~ s/(.)\1{3,}/$1$1$1/gs;
Updated: It is faster because it makes one substitution per char sequence. It replaces four or more repeated characters by three at one time.
|
|---|