Alternatively you can reverse, sub, reverse, but I like Vince's way. On 7/26/06, Vincent Fourmond <vincent.fourmond / 9online.fr> wrote: > > Hello ! > > > s.gsub(/XX\z/,'') solves the problem in a static way. > > s.gsub(r,'') solves it too, but who can I specify, that only the last > > occurence should be replaced. > > Would > s.gsub(/#{r}$/,'') > do what you want ? > > Vince > > > -- Matt