mIRC Home    About    Download    Register    News    Help

Print Thread
#177241 22/05/07 01:55 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Currently I have
Code:
if $istok(%rkb_at_networks,$network,32) {
which works fine, if the person enters the exact match for the network, but I was wondering if there was a way (preferably easy) to allow for a partial match (eg: Pleasure would match Pleasurenet) and still allow for multiple networks to be passed through the single variable.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
if $wildtok(%rkb_at_networks,$+(*,$network,*),1,32) {

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Unless I'm doing my tests incorrectly, when I test your solution, hixxy, I keep getting an insufficient parameters error
I'm testing using
Code:
//echo -a $wildtok(pleasure pleasant xdcc,*pleasurenet*,1,32)


What I want, is for the code to return 1 since the provided word for the network match is pleasure and the actual network is pleasurenet.

RusselB apologizes for not providing a clear example with his first post

Last edited by RusselB; 22/05/07 02:30 AM.
Joined: May 2007
Posts: 23
C
Ameglian cow
Offline
Ameglian cow
C
Joined: May 2007
Posts: 23
Originally Posted By: hixxy
Code:
if $wildtok(%rkb_at_networks,$+(*,$network,*),1,32) {
Originally Posted By: RusselB
... but I was wondering if there was a way (preferably easy) to allow for a partial match (eg: Pleasure would match Pleasurenet) and still allow for multiple networks to be passed through the single variable.


that $wildtok won't cause the token "pleasure" to match the wildcard text *Pleasurenet* in that example the way $wildtok compares.. you could try doing something like

Code:
if ($wildtok(%rkb_at_networks,$+(*,$network,*),1,32)) || ($wildtok(%rkb_at_networks,$replace($gettok($network,1,46),$chr(45),$chr(42)),1,32)) { whatever }


so you can go for more exact matches if they exist but otherwise take only the first token seperated by . so you remove the tld and replace "-" with * so it will match more common partials i.e..

network whatever.net will be changed to "*whatever*"

networks like Chat-Net.org will be changed to "chat*net" in case someone uses network name "chatnet"

I think that should match anything people actually expect to match


Edit: err.. I just realized mine wont match "pleasure" to a "pleasurenet" network name either.. also realized a || is fine instead of elseif because if the first one matches it'll go with that result everytime

Last edited by chiram; 22/05/07 04:26 AM.
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks...that works great in my tests.

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I'm not sure I got what you want correctly, but have you tried $matchtok?


"All we are saying is give peace a chance" -- John Lennon
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I did try it, however, it doesn't work properly with wildcards.


Link Copied to Clipboard