vendredi 8 mai 2015

Find Value by position on plain HTML in ruby

My Html file is not having any classes . I am trying to get the no. from the plain Html

<html>
 <head></head>
  <body>
     PO Number : [4587958]   
  </body>
</html>

I am able to find out the PO Number test by using

require 'rubygems'

require 'nokogiri'   

PAGE_URL = "a.html"

page = Nokogiri::HTML(open(PAGE_URL))

data = page.css("body").text
puts data 
test = data
ponumber = test.scan('PO Number')
puts ponumber

I am not able to get the no.

Aucun commentaire:

Enregistrer un commentaire