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.

String Match

Old posts that have not been replied to for several years.
Locked
L
Locutus

Post by Locutus »

Is there a way to use wild cards in sting match?

for this example $nick = bleh

if {[string match $nick ble*]} { do something
}

In traditional mirc, we would use:

if (ble isin $nick)

Thanks...
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

you've got your string and pattern the wrong way round

try [string match *blah* $nick]
L
Locutus

Post by Locutus »

[string match bl* $nick]

didn't work....

point of note: if I do the full nick, it works..

[string match $nick bleh]

Thanks again..!
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

[04:45] <Petersen> .tcl set test blah
[04:45] <gaynewf> TCL: blah
[04:45] <Petersen> .tcl string match bl* $test
[04:45] <gaynewf> TCL: 1
[04:45] <Petersen> .tcl string match ab* $test
[04:45] <gaynewf> TCL: 0

wildcards work fine for me.
L
Locutus

Post by Locutus »

You are right!

Thank you for your help

Locu
Locked