| View previous topic :: View next topic |
| Author |
Message |
Craig Voice
Joined: 22 Feb 2006 Posts: 18
|
Posted: Thu Mar 22, 2007 4:00 pm Post subject: |
|
|
| Code: | ; set arg "lol http:// http://lol www.lol www ftp:// lol ftp://:P"
#101 (56 clicks) Tcl: lol http:// http://lol www.lol www ftp:// lol ftp://:P
; set arg [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
#103 (121 clicks) Tcl: http:// http://lol www.lol ftp:// ftp://:P |
i dont understand you, lsearch is working with $arg and also when i'll try "putquick : privmsg $chan $bwfound" it will return that words. :O
| Code: | set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
putquick " privmsg $chan : BW FOUNDED: $bwfound" |
>>
10.:142110·140010·140810:. 03«~Thiev03» http:// lol ftp:// lol http://lol lol ftp://lol lol
10.:142110·140010·140810:. 03«@dghnws03» cos znalazlem!
10.:142110·140010·140810:. 03«@dghnws03» BW FOUNDED: http:// ftp:// http://lol ftp://lol |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 22, 2007 4:03 pm Post subject: |
|
|
The problem is that arg can never contain a newline, yet you use a mask that does contain a newline... should be quite obvious the mask will never match..
And as for lsearch:ing arg, you're just getting away with with sheer luck.. should arg contain characters such as {[]} and similar, you'd be up for a "nice" surprise... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Craig Voice
Joined: 22 Feb 2006 Posts: 18
|
Posted: Fri Mar 23, 2007 12:03 pm Post subject: |
|
|
tell me how to do thing like
if { ([string match -nocase "* $helpwanted *" $input] ===== 1
i want to it replay 0 when there is full zeros like
in $helpwanted is
bla
he
hi
andf return 0 if no one word match with $input .. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Mar 23, 2007 1:52 pm Post subject: |
|
|
Use proper lists and do a foreach loop to use each list item as a pattern with "string match", don't expect "string match" to pick a part of the pattern and match it against the text-string.
That is, given that "patterns" holds a valid list structure and "text" the text string, something like this:
| Code: | foreach item $patterns {
if {[string match $item $text]} {
puts stdout "It matched!!!"
break
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|