"Arie Kusuma Atmaja" <ariekusumaatmaja / gmail.com> schrieb im Newsbeitrag news:8c1bd61c05032102481fc4beb2 / mail.gmail.com... > s = 'Heiiiiiiiiiiiiii mauu kemannnnaaaaaaaaa?' > puts s.squeeze # right, means 'where r > u going?' (Indonesian) > > indoscripts = 'Tq, canggihhh meeeennnn.......' > puts indoscripts.squeeze # should be canggih, > not cangih (Indonesian) > > milis = 'Scholarships often go abegging' > puts milis.squeeze # should be abegging, > not abeging (English) > > french = %Q/Salut! Je m'appelle Arie. Ruby tous les jours :)/ > puts french.squeeze # should be Je > m'appelle, not m'apele > > Should I have words' database to make it right? As this is obviously a language depedent feature that's certainly the best approach. You might get away with doing this: # replace sequences of three or more subsequent characters s.gsub(/(\w)\1{2,}/, '\\1') >> s = 'Heiiiiiiiiiiiiii mauu kemannnnaaaaaaaaa?' => "Heiiiiiiiiiiiiii mauu kemannnnaaaaaaaaa?" >> s.gsub(/(\w)\1{2,}/, '\\1') => "Hei mauu kemana?" >> s = 'Scholarships often go abegging' => "Scholarships often go abegging" >> s.gsub(/(\w)\1{2,}/, '\\1') => "Scholarships often go abegging" You might as well anchor at word end if that helps: >> s = 'Heiiiiiiiiiiiiii mauu kemannnnaaaaaaaaa?' => "Heiiiiiiiiiiiiii mauu kemannnnaaaaaaaaa?" >> s.gsub(/(\w)\1+\b/, '\\1') => "Hei mau kemannnna?" Kind regards robert