William James
2/10/2009 8:19:00 AM
Joao Silva wrote:
> how i can extract:
>
> <td>Traffic left:</td><td
> align=right><b><script>document.write(setzeTT(""+Math.ceil(-123313/100
> 0)));</script> MB</b></td>
>
> i need this nuber: 123313? I tried to match this in many ways but i
> stil have problem with escape characters.
list = DATA.read.scan( %r{<td.*?>\s*(.*?)\s*</td>}im ).flatten
list.each_cons(2){|a,b|
if "Traffic left:" == a and b =~ /Math.ceil\((-?\d+)/
p $1
end
}
__END__
<td>NOT TRAFFIC LEFT:</td><td
align=right><b>
<script>document.write(setzeTT(""+Math.ceil(-9999999/1000)));
</script>
MB</b></td>
<td> Traffic left:
</td><td
align=right><b><script>
document.write(setzeTT(""+Math.ceil(-123313/1000)));
</script>
MB</b></td>