From: Ckvok Kovsky Date: 2008-01-09T10:44:11+09:00 Subject: gsub mass substitution Hello. I'm a ruby newbie. I'd like to make a "mass substitution" version of gsub, like in the sed example: $echo "叩stur達kols辿" | sed -e 'y/叩達辿/aae/' asturakolse Alike, I'd do something like "達ol辿l端".gsubm("達辿端","aeu") which would return "aolelu" ----->Code-1: class String def gsubm(letras_ruins,substituir_por_este_char) resultado = self.split(//).each {|letra_do_self| letras_ruins.split(//).each {|letra_a_substituir| letra_do_self.gsub(letra_a_substituir.to_.join.squeeze,substituir_por_este_char) #.join.squeeze #p 'ls:' + letra_do_self.squeeze } } return resultado.join end end p "Leein叩d".gsubm("叩",'a')a ----->Code-2: p "leein叩達d".sub(/[叩達]/,'a') I didn't get success in any case. I've searched a lot also, but couldn't find any solution. Thanks in advance for any help. -- Posted via http://www.ruby-forum.com/.