From: Romain LOMBARDO Date: 2008-07-28T21:44:41+09:00 Subject: Gsup with variable when replacing Hi people, I'm trying to transform this kind of line : 123232321 FOOFOOFOO .. 2431232 BARBARBAR to 123232321 (actually XML) 2431232 So I have coded this script File.open("D:/digisoft/1b.txt","r") do |f2| while line = f2.gets f3 = line.gsub!(/\d+$/,'\1') puts f3 end end but Ruby doesn't seem to apraciate .. I search example and I found that variable as $1, \1, &$ could do this job but i can't get it works. How can I get the match of my regexp and add blocks please ? thanks you