From: Sebastian Hungerecker Date: 2008-07-28T21:51:47+09:00 Subject: Re: Gsup with variable when replacing Romain LOMBARDO wrote: > f3 = line.gsub!(/\d+$/,'\1') \1 means "first group", but there are no groups in your regex. \0 means "whole match", so that's the one you want. Another thing: gsub! is the mutating variant of gsub. It will return nil when no change occurs or self when there is a change. Either way it does not make sense to store its return value. And yet another thing: there is no sense in using gsub (as opposed to sub) with a regex that only matches once anyway. HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826