From: Peter Bailey Date: 2006-05-23T23:01:32+09:00 Subject: Substituting with a find counter . . . In this gsub block, I'd like to save the searched parenthetical data, indicated by (.*) in line 2. The script works, but, instead of getting the parenthetical data, I'm getting "$1." Very literal, but, not what I want. What am I doing wrong? Thanks. Peter 1 counter = 0 2 contents.gsub!(/^%%Page:(.*)[0-9]{1,5}$/) do |match| 3 counter += 1 4 "%%Page: $1 #{counter}" -- Posted via http://www.ruby-forum.com/.