egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regexp doesn`t work

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sat Jan 07, 2006 7:39 am    Post subject: Regexp doesn`t work Reply with quote

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
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Jan 08, 2006 8:51 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sun Jan 08, 2006 9:54 am    Post subject: Reply with quote

There are html codes for examples, but If I use it doesnt work, only works with 1 regexp.
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Jan 08, 2006 10:07 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Sun Jan 08, 2006 2:02 pm    Post subject: Reply with quote

Doesn`t work = Bot do not sends any msg to channel.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Jan 08, 2006 9:20 pm    Post subject: Reply with quote

Code:
.set errorInfo

Paste output.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber