Help on html content modification

Dear all,

i have a html file in my local path.

In that html file i have below tag.

Now what i need is i want to modify the above tag into

i want to replace all the image path like above path.

Is it possible to do? i have a idea in hpricot parser.

Is it worth to try with hpricot…

if so,kindly provide any sample code or links

Thank you for your time

Here’s a hpricot example that works:

require ‘rubygems’
require ‘hpricot’

doc = Hpricot(“


”)‘img’).each do |img|
img[‘src’] = img[‘src’].gsub(/^/\d{4}-\d{2}-\d{2}/, “”) # have to do
– gsub! doesn’t work

puts doc.html

Anyone, if this can be done smarter, please write.


2010/2/15 Newb N. [email protected]