Friday, November 8, 2013

[Rails] how to search the phrase of numbers

Hi,Dear all,

I am trying to search the phrase of numbers in a html page in the
sentence below:

<div class="Results" id="yui_3_11_0_4_1383957936583_5009">(253
items)</div>

I used this piece of code, but it does not work,

limit= page.search("div[class=Results]").search("div").gsub("items","")

begin
Integer(limit)
rescue
return 0
end

Would you give me any suggestion on this?

Thank you,
Regards,
Di

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6a45f31e319bcf5e68945621da460e65%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate