This snippet will make a request to this page and extract the title from the title tag.
require 'open-uri'html = open('http://www.seanbehan.com/how-to-extract-the-title-from-an-html-page-with-ruby').read
title = html.match(/
(.*)<\/title>/) { $1 } puts title
The regular expression here matches everything between the title tags. Anything within the parens "(.*)" is kept around as variable which you can access in the block with variables $1, $2, $3... $n, depending on how many matches are found.
Just finishing up brewing up some fresh ground comments...