From: "Jesús Gabriel y Galán" Date: 2008-01-09T18:31:04+09:00 Subject: Re: gsub mass substitution On Jan 9, 2008 2:44 AM, Ckvok Kovsky wrote: > 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" > p "Leeinád".gsubm("á",'a')a > > I didn't get success in any case. I've searched a lot also, but couldn't > find any solution. Maybe tr will work for you: irb(main):012:0> "abcdefghijk".tr "abc", "123" => "123defghijk" It supports character ranges, and padding the second argument with its last character if it's shorter than the first one: "hello".tr('aeiou', '*') #=> "h*ll*" "hello".tr('^aeiou', '*') #=> "*e**o" "hello".tr('el', 'ip') #=> "hippo" "hello".tr('a-y', 'b-z') #=> "ifmmp" I was having some problems testing your cases, I think because of the strange chars, maybe that's the source of your problems too? Hope this helps, Jesus.