I'm trying to match and extract pieces from structured text in a similar
way to what sgrep (see <http://www.cs.helsinki.fi/~jjaakkol/sgrep.html>)
does.

The concrete purpose is to get titles from HTML files, that is the first
occurrence of any text between <title> and </title>. Better still, I'd
like to get the "X" from <html>..<head>..<title> X </title>..</head>.

Is there a idiomatic way to do such a thing in Ruby? In particular, it
would be very nice, if I could specify what I want in a way similar to
the above.

Michael

-- 
Michael Schuerig
mailto:schuerig / acm.org
http://www.schuerig.de/michael/