extract a number from a line of HTML file

A

Ak 756

Hi,

I have a line of HTML file like this

<td><B><font color=006689>123.20</font></B></td>

I want to remove all such HTML tags as '<xxx>' and only get the 123.20.

Would anyone kindly tell me how?

Thanks very much.
 
A

Ak 756

Daniel said:
Your going to need to give some more information here. Using
javascript?
On the server side? Is it always that format?

Hi Daniel

I got this line from the body of NET::HTTP.post_form. I want to extract
the digital number embedded in this line. Actually ,I think I can do
this by remove all strings begin with "<" and end with ">". But I don't
know how to do.
 
A

Ak 756

Daniel said:
So server side... If you use the Hpricot Gem you can do this pretty
easy.

a = "<td><B><font color=006689>123.20</font></B></td>"
value = Hpricot( a ).innerText.strip

HTH
Daniel

Hi Daniel

Thanks! Great gem! It's exactly what I want, and so simply!
Thanks very much.

ak756
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top