Hi i have previously managed to extract links from html using the follownig code:
html.scan(/src\s*=\s*"(.*?)"/im) { |item|
link = item.to_s
}
this worked great, however i want to extract some other text from html, and i dont quite understand how the paramaters passed to the scan method work.
can anyone explain or have a good link about this?
bump
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] RDoc Documentation [2] http://www.ruby-doc.org/core/classes/StringScanner.html [3] http://code.whytheluckystiff.net/hpricot/
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.