Forum: Ruby on Rails how to search the phrase of numbers

1f47aa8b39bba61ec339854722e7657f?d=identicon&s=25 Dina Z. (dina_z)
on 2013-11-09 02:54
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
Aa082c8b00a50928e5860dcd70bf2368?d=identicon&s=25 tamouse m. (tamouse_m)
on 2013-11-09 23:58
(Received via mailing list)
On Nov 8, 2013, at 7:54 PM, Dina Z. <lists@ruby-forum.com> wrote:

> 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?

Break apart the chain of method calls above, and see what each is
returning.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.