views:

113

answers:

0

Can someone please tell me how to convert this line of Javascript to Ruby using Hpricot & RegEx?

// Replace all doubled-up <BR> tags with <P> tags, and remove fonts.
    var pattern =  new RegExp ("<br/?>[ \r\n\s]*<br/?>", "g");
    document.body.innerHTML = document.body.innerHTML.replace(pattern, "</p><p>").replace(/<\/?font[^>]*>/g, '');

The code I have setup is:

require 'rubygems'
require 'hpricot'
require 'open-uri'

@file = Hpricot(open("http://www.bubl3r.com/article.html"))

Thanks