extracting text from a string

The ruby api [1] has some useful information on the scan function. The page you are interested in is probably [2]. If you are going to be manipulating html documents, you might want to check out Hpricot [3], or some other html parser.

[1] http://www.ruby-doc.org/core/
[2] http://www.ruby-doc.org/core/classes/StringScanner.html
[3] http://code.whytheluckystiff.net/hpricot/