in reply to Re^2: Supress similar chars in the string
in thread Supress similar chars in the string
s/((.)\2{$n})\2*/$1/g;
Shouldn't the \2* (zero or more of...) term in the regex above be \2+ (one or more of...) instead? I.e.:
s/((.)\2{$n})\2+/$1/g;
Won't the \2* version lead to useless replacement of sub-strings of n identical characters with the same n-character sub-string (Update: where n is the maximum number of contiguous identical characters originally defined)?
Update: This really should have been posted as a reply to Re: Supress similar chars in the string.
|
|---|