cannot I search the doc's contents (doc=file.read) one more times?

S

shaobo.li

Hi,
I wanna retrive ip and its port from the html file which contains
"<tr bgcolor=#e3e6ea><td>61.135.158.111</td>
<td>80</td>",cannot I search the doc's contents (doc=file.read) one
more times?

doc=file.read

#first get ip'es success
ips=doc.scan(/(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3})/)
ips.each {|ip| puts ip }

#then get ports still on doc ,but no one got nothing,if commentted
above ip scans ,this would works.
ports=doc.scan(/<td>(\d+)<\/td>/)
ports.each {|port| puts port }

file.close

Thanks in advance!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top