Given:
require \'rubygems\' require \'nokogiri\' value = Nokogiri::HTML.parse(<<-HTML_END) \" A
A
Use the xpath function starts-with:
starts-with
value.xpath('//p[starts-with(@id, "para-")]').each { |x| puts x['id'] }