From: Steel Steel Date: 2010-10-19T22:08:38+09:00 Subject: Re: Find block in a long string Greg Ma wrote in post #955398: > Hi, > > I am parsing a rss feed and i am try to extract a specific element from > an attribute. > > The attribute looks like this, and I would like to extract the location > from it. > "<p>\n <strong>Location:</strong> Columbus, > Ohio\n</p>\n\n<" > > Here is the horrible code I've done, could you help me to make it > cleaner :) > > description.split("\n").each do |ugly| > next unless ugly.include?("Location") > location = ugly.split("\n")[1].split("gt;").last > end > > Greg Ruby has an RSS parser isn't it? Why not use it? http://ruby-doc.org/core/classes/RSS.html http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en -- Posted via http://www.ruby-forum.com/.