From: Jim Burgess Date: 2009-10-13T16:39:41+09:00 Subject: Re: Making one reg ex out of two > This looks like an XML string. Did course_info come from an XML > document? An XML parser like Hpricot or Nokogiri would be an > improvement. Quick update: Just installed and followed a quick tutorial on Hpricot. While effectively accomplishing the same task, this parser makes the code much easier to read. I can now write: doc = Hpricot.parse(File.read("courses.xml")) (doc/:course).each do |course| if (course/:date).inner_html.match "#{date}" groups_that_had_lessons_this_month << (course/:title).inner_html end end as opposed to this (or worse): File.open("courses.txt", 'r') do |datei| datei.readlines.select do |line| if line.match "#{date}" groups_that_had_lessons_this_month << line[ /([^<]+)/, 1 ] end end end Thanks for the recommendation, and thanks everyone else for the answers too. -- Posted via http://www.ruby-forum.com/.