From: "Peña, Botp" Date: 2007-06-28T14:03:58+09:00 Subject: Re: More Regexp and file load problems From: Don Levan [mailto:levandon@gmail.com] : # file = File.new('/Users/donlevan/Desktop/DDRs/Apple Dealer Price # List.xml') # # file.each do |line| # if line =~ regexp since your regex passes the string test, i would suspect the contents of the file itself. possibly the expression is broken into multiple lines.. # puts "#{$1}" # end # end try grepping the file first root@pc4all:~# grep -i Helvetica test.txt Helvetica then pass the result to simplified ruby program root@pc4all:~# cat test.rb regexp = Regexp.new(/^\s*(\w*)<\/Font-family>\s*$/) ARGF.each do |line| if line =~ regexp puts "#{$1}" end end root@pc4all:~# grep -i Helvetica test.txt | ruby test.rb Helvetica