From: Dan Diebolt Date: 2008-07-13T13:43:43+09:00 Subject: Re: Hpricot question --0-1506493909-1215924478=:69289 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit >What I need, however is a method that tells me the first HTML tag of a fragment, whatever it is Try this: a_fragment = '
first div

a paragraph

a span
' doc=Hpricot(a_fragment) tag=doc.search("[1]").first.name => "div" --0-1506493909-1215924478=:69289--