Code: Select all
regexp {\d+\.\d+} {<td width="55%"><font face="Verdana, Arial, sans-serif" size=2 class="fontNormal">0.6193</font></td>} value
Code: Select all
regexp {<.+><.+>(.+)<.+><.+>} {<td width="55%"><font face="Verdana, Arial, sans-serif" size=2 class="fontNormal">0.6193</font></td>} grbg value
Code: Select all
# variable $lines is a list containing the html source
set notFound 1
foreach line $lines {
if {$notFound && [regexp {Kills\sper\sDeath:} $line]} {
set notFound 0
} elseif {!$notFound} {
regexp {\d+\.\d+} $line value
break
}
}
# $value contains the number.
Code: Select all
set notFound 1
set lines [split $::html \n]
foreach line $lines {
if {$notFound && [regexp {Kills\sper\sDeath:} $line]} {
set notFound 0
} elseif {!$notFound} {
putquick "PRIVMSG $chan : Line $line found"
regexp {\d+\.\d+} $line value
putquick "PRIVMSG $chan : Value is $value"
break
}
}
Code: Select all
proc bla {} {
set url "http://ns.wireplay.co.uk/hlstats.php?mode=playerinfo&player=55"
set token [::http::geturl $url]
set content [::http::data $token]
::http::cleanup $token
set notFound 1
foreach line [split $content \n] {
if {$notFound && [regexp {Kills\sper\sDeath:} $line]} {
set notFound 0
} elseif {!$notFound} {
regexp {\d+\.\d+} $line value
puts $value
break
}
}
}
% package require http
2.5.2
% bla
0.6649
Code: Select all
proc blo {} {
set url "http://ns.wireplay.co.uk/hlstats.php?mode=playerinfo&player=55"
set token [::http::geturl $url]
set content [split [::http::data $token] \n]
::http::cleanup $token
if {[set i [lsearch -glob $content {*Kills per Death:*}]]!=-1} {
regexp {\d+\.\d+} [lindex $content [incr i]] value
puts $value
}
}