From: John Smith Date: 2010-09-17T23:58:17+09:00 Subject: Re: Printing part what's found with a regex Jonathan Nielsen wrote: > You will find that portions of the regex marked with parentheses will be > places in variables called $1, $2, etc. So, you will want to change the > regex to > > /(?!%)\w+\s+(\(\w+\))/ > > And then the contents of (\(\w+\)) will be placed in the variable $2. > > -Jonathan Nielsen hmm I'm trying to print this variable but I get nothing. I've tried: puts "#$2" puts "#{$2}" -- Posted via http://www.ruby-forum.com/.