From: Robert Klemme Date: 2010-11-02T19:28:12+09:00 Subject: Re: "<-----/strings/----->" my ruby http client, link search. On Sun, Oct 31, 2010 at 7:24 AM, Michael Fellinger wrote: > On Sun, Oct 31, 2010 at 9:08 AM, Bigmac Turdsplash wrote: >> im not sure how to ask this question... >> Imagen the body of a webpage as the string im searching threw... >> >> [body] >> > style="font-size:15 >> > style="font-size:15 >> > style="font-size:15 >> > style="font-size:15[/body] >> >> i need to find this /files/ then on the left side and right side there >> are quotes "<------/files/------>" >> >> i need all the data in between each quote, this will be a download link >> my script will need to find... >> >> im not sure how to do this... please help if you can > > require 'nokogiri' > text = < style="font-size:15"> > style="font-size:15"> > style="font-size:15"> > style="font-size:15"> > HTML >>> Nokogiri::HTML(text).xpath('//a[contains(@href,"/files/")]').map{|a| a[:href] } > => ["htxp://www.xxxxxx/files/xxxxxxx/xxxxxxxx"] Or even doc.xpath('//a[contains(@href,"/files/")]/@href').map(&:value) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/