mIRC Home    About    Download    Register    News    Help

Print Thread
Match data using wildcard hashtable item search? #267186 15/04/20 06:07 PM
Joined: Jul 2007
Posts: 61
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 61
Hi. Is it possible to $hfind table items containing a wildcard and matching the data, or do you have to $hfind match the data, then loop through the list to check if the table item is correct?

For example, say I have the following table:
Code
some.item.HASH1.startedby adam
some.item.HASH1.finishedby brian

some.item.HASH2.startedby charlie
some.item.HASH2.finishedby adam

some.item.HASH3.startedby adam
some.item.HASH3.finishedby adam


And I want to find all the hashes where *.startedby = adam. Logically something like `if some.item.*.startedby = adam, then add item to list`. The resulting like would be:
Code
some.item.HASH1.startedby
some.item.HASH3.startedby


As far as I can tell, it's only possible to search *all* table items for a data match but not search wildcard-matched items for a data match.

Thanks for the help guys!

Re: Match data using wildcard hashtable item search? [Re: beer] #267188 15/04/20 08:09 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
You can only search for item, or for data, not both at once, the easiest would be to match on item for "some.item.*.startedby" and check if that item's value is adam:

Code
noop $hfind(table,some.item.*.startedby,w,0,if ($hget(table,$1) == adam) var %list %list $1)
echo -s item matching: %list


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Match data using wildcard hashtable item search? [Re: Wims] #267189 16/04/20 01:12 AM
Joined: Jul 2007
Posts: 61
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 61
That's what I figured, thanks for clarifying Wims!

note: Just noticed the $hfind has "w,0" which is the reverse order. Should be "0,w".

Last edited by beer; 16/04/20 01:45 AM.
Re: Match data using wildcard hashtable item search? [Re: beer] #267190 16/04/20 03:17 AM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
There is no universe where I don't make this mistake eek


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net