From: Daniel Carrera Date: 2003-01-12T10:19:05+09:00 Subject: Re: a smart way... Hi Daniel, The brackets () in a regular expression cause Ruby to "remember" the matches. The first match is stored in $1, the second in $2 and so on. line = '' line =~ /file( +)name( *)=( *"(.+)")( *)/ ^ ^ ^ ^ ^ $1 $2 $3 $4 $5 In this case, you are interested in $4 Example: $ irb --simple-prompt >> line = '' >> line =~ /file( +)name( *)=( *"(.+)")( *)/ >> $4 "daniel" Cheers, Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137