If there are more than 2 characters
“Hiiiiiii
My friend!!!!!!!”
“Hiiiiiii
My friend!!!!!!!”
I need to reduce to
“Fei Yichuan
My friend!!”
Please note that in my language, there are many double-character words.
Thnx in advance
kplla
Perl / regex (if it’s not in English, Perl gives me better than Unicode Luck):
#!/usr/bin/perl
$str = "Hiiiiii My Frieeeeend!!!!!!! ";
$str =~ s/(.)+/$1$1/g;
print $str;
If there are more than 2 characters
“Hiiiiiii
My friend!!!!!!!”
I need to reduce to
” Fei Chuan
My friend!!”
Please note that in my language, there are many double-character words.
Thnx in advance
kplla
Perl / regex (If it is not in English, Perl gave me better luck than Unicode):
#!/usr/bin/perl
$str = "Hiiiiii My Frieeeeend!!!!!!!";
$str =~ s/ (.)+/$1$1/g;
print $str;