Re: [Rails] HELP ON HTML CONTENT MODIFICATION

2010-02-15 Thread Lasse Bunk
Here's a hpricot example that works: require 'rubygems' require 'hpricot' doc = Hpricot(htmlbodypimg src=\/2010-01-12/Capture/1210420100112145725141.jpg\ //p/body/html) doc.search('img').each do |img| img['src'] = img['src'].gsub(/^\/\d{4}-\d{2}-\d{2}/, ) # have to do gsub – gsub! doesn't

[Rails] HELP ON HTML CONTENT MODIFICATION

2010-02-14 Thread Newb Newb
Dear all, i have a html file in my local path. In that html file i have below tag. img src=/2010-01-12/Capture/1210420100112145725141.jpg / Now what i need is i want to modify the above tag into img src=/Capture/1210420100112145725141.jpg / i want to replace all the image path like above