From: Guest Date: 2006-05-16T22:35:51+09:00 Subject: Re: Problem with my gsub! Wilson Bilkovich wrote: > On 5/16/06, Guest wrote: >> same gsub! line? >> >> Thanks again. >> > > The block form of gsub is one way to go about it: > counter = 0 > content.gsub!(/^%%Page:.*([0-9]{1,5})$/) do |match| > counter += 1 > "%%Page: #{counter}" > end > > Whatever the block returns is used to replace the matched text. Cool. Thank you both very much. This is a very generous forum, I must say. -Peter -- Posted via http://www.ruby-forum.com/.