This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

big "string match" problem

Old posts that have not been replied to for several years.
Locked
m
misterys
Voice
Posts: 23
Joined: Sun Mar 30, 2003 2:43 pm

big "string match" problem

Post by misterys »

Hi,

the script is working, but not like i want :roll:

i bind the servers' connection notice and split it :)

so far so good :D :D, but it's not enough to check just
if ident matches the list.
i think best way is to check is, if one part of the nickname and the realname or ident is on the list,
but how to do this?
if i use

Code: Select all

if { [string match $[censored] $ident ] && [string match $[censored] $nick] } {
nothing is working anymore.
maybe there is a way to do this without using "string match" ?



sorry for my bad english :(
and thanks for help
misterys
Last edited by misterys on Fri Sep 17, 2004 11:51 am, edited 1 time in total.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well you can match everything using string match and lsearch as both are almost the same however for lists using lsearch is better and faster and does not require you adding a foreach loop for each element in the list.


LIST MATCHING (LSEARCH)

Code: Select all

#Set your nicklist
set nicklist "awyeah junior jumbo ariel maxy mike"

#Set your identlist
set identlist "user pro smoke dark evil devil child satan"

#For list matching the 'nick' in the nicklist
if {([lsearch -exact [split [string tolower $nicklist]] [string tolower $nick]] != -1)} { 

#For list matching the 'ident' in the identlist
if {([lsearch -exact [split [string tolower $identlist]] [string tolower [lindex [split $uhost "@"] 0]]] != -1)} { 
You can also do that with string match.


STRING MATCHING (STRING MATCH)

Code: Select all

#Set your nicklist
set nicklist { "awyeah" "junior" "jumbo" "ariel" "maxy" "mike" }

#Set your identlist
set identlist { "user" "pro" "smoke" "dark" "evil" "devil "child" satan" }

#For string matching the 'nick' in the nicklist
foreach newnick $nicklist
if {([string match -nocase *$newnick* $nick])} {

#For string matching the 'ident' in the identlist
foreach newident $identlist
if {([string match -nocase *$newident* [lindex [split $uhost "@"] 0]])} {

You can do the realname one in the same way as I just mentioned either use string match or lsearch. For the realname one check this thread out, it is an entire script related to it. :mrgreen:

http://forum.egghelp.org/viewtopic.php?t=8248
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
misterys
Voice
Posts: 23
Joined: Sun Mar 30, 2003 2:43 pm

Post by misterys »

thanks a lot - I-WORM / Mymoon sucks
Locked