On Jul 5, 2007, at 8:50 PM, Ari Brown wrote: > Ok. I have a major pattern matching problem. In essence, right now > the word i am trying to match is "hello", WITH double quotes around > it. > > Why isn't this working? It always hits the else part of my case- > when loop. > > write_file = open('albuminfo.txt', 'w') > lines.each do |line| > puts line > case line > when line =~ /^(.+)$/ > write_file.puts('"#{$1}"') > write_file.close > print '.' > else > print '$' > end > end Others have pointed out a problem with your case statement, but I think there's another problem here -- your #{$1} substitution isn't going to work in single-quoted string. Regards, Morton