|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Currently I have 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,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
if $wildtok(%rkb_at_networks,$+(*,$network,*),1,32) {
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Unless I'm doing my tests incorrectly, when I test your solution, hixxy, I keep getting an insufficient parameters error I'm testing using //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.
|
|
|
|
chiram
|
chiram
|
if $wildtok(%rkb_at_networks,$+(*,$network,*),1,32) { ... 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
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,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Thanks...that works great in my tests.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
I'm not sure I got what you want correctly, but have you tried $matchtok?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
I did try it, however, it doesn't work properly with wildcards.
|
|
|
|
|