Tag and attribute in Nokogiri

Hi all,

Just a quick question: I want to extract some info from one webpage.
How do I return all tag that contains id attribute that contains
‘my_img’?

Enclosed is one example for the format in my webpage and part of my
script.

doc = Nokogiri::HTML(open(fn))
puts doc.search(‘img[@id]’)

My script will return all with id attribute. But I would like to
return the first 3 ONLY.

Thanks,

===================