Ruby (mechanize , net/http)

Hi guys.
Im using mechanize to get some images from the web application. I have 2 problems: 1-st : I cant catch the links. The whole link looks like <a href =
"https://…/reports/switch_accounts.html?.."See full report

And there`re couple of these that i try to catch with a singe regexp

i tried this :

final.links_with(:href => %r{/switch_accounts.html/} ).each do |link|
puts link.href, link.text

but it doesnt display anything, but im pretty much sure there`re those
links in the ‘final’ webpage

The second problem - how can i actually save the images to a selected
folder(assuming i have the links for them)?

Thatnks everybody, any ideas are really appreciated


If you didn’t find it yet:

str1 = ‘http://…reports/switch_accounts.html?..’
=> “http://…reports/switch_accounts.html?..”

re1 = %r{/switch_accounts.html/}
=> //switch_accounts.html//

str1.match re1
=> nil

str2 = ‘http://…reports/switch_accounts.html/?..’
=> “http://…reports/switch_accounts.html/?..”

str2.match re1
=> #MatchData:0xb7e1695c

re2 = %r{/switch_accounts.html?}
=> //switch_accounts.html?/

str1.match re2
=> #MatchData:0xb7e0c8d0

I don’t know mechanize, but str2 is an url your regex (re1) would match.
re2 is the regex that matches your sample url.

Regards, R.