| View previous topic :: View next topic |
| Author |
Message |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sat Jan 07, 2006 7:39 am Post subject: Regexp doesn`t work |
|
|
If i use one regexp with "set all" it works, but if I try to use more than 1 it doesn`t work, why?
| Code: | package require http
bind pub - !news www:news
proc www:news {nick host handle chan text} {
set token [::http::geturl http://www.sensiblesoccer.de/index.php?lng=en -timeout 10000]
set status [::http::status $token]
if {$status!="ok"} {
switch -exact -- [string tolower $status] {
reset { puthelp "PRIVMSG $chan :error: server connection was reset." }
timeout { puthelp "PRIVMSG $chan :error: server timeout (10 seconds)" }
default { puthelp "PRIVMSG $chan :unknown server error occured" }
}
::http::cleanup $token; return
}
if {[::http::ncode $token]=="404"} {
::http::cleanup $token
puthelp "PRIVMSG $chan :Sorry, error 404"; return
}
set data [::http::data $token]; ::http::cleanup $token
set all [regexp -all -inline -nocase -- {<td class="medium"><b class="marker">(.*?)</font></td>} $data]
set count 1
foreach {tmp t} $all {
if {$count=="4"} {return}
incr count
}
set all2 [regexp -all -inline -nocase -- {<td class="medium"><b class="marker">(.*?)</} $data]
set count 1
foreach {tmp t2} $all {
if {$count=="4"} {return}
puthelp "PRIVMSG $chan :($count) $t $t2"
}
} |
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Jan 08, 2006 8:51 am Post subject: |
|
|
what does not work there? All is all, there is no more. If you make another regexp on the same string it will beginng from start again and they might even return the same depending on the source.
Maybe you should write more about what you expect of the 1st and 2nd regexp. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sun Jan 08, 2006 9:54 am Post subject: |
|
|
| There are html codes for examples, but If I use it doesnt work, only works with 1 regexp. |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Jan 08, 2006 10:07 am Post subject: |
|
|
I suppressed the comment last time, but "Doesn't work" is no error description and therefore it won't help us to help you. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Sun Jan 08, 2006 2:02 pm Post subject: |
|
|
| Doesn`t work = Bot do not sends any msg to channel. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Jan 08, 2006 9:20 pm Post subject: |
|
|
Paste output. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
|