$hfind » History » Revision 20
Revision 19 (Per Amundsen, 12/14/2019 09:33 AM) → Revision 20/21 (Per Amundsen, 02/23/2023 08:02 PM)
_Added in 1.9.0_ *$hfind(name|N,text,[N],[options],[@window|command])* *$hfind(name|N,text,[N],[M],[@window|command])* Searches table for the Nth item name which matches text and returns the item name. _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hget]]._ _See also [[$hmatch]], [[$hregex]]._ *Parameters* table(ktable). |*Parameter*|*Description*| | name<notextile>|</notextile>N | name|N - Name of the hash table or the Nth hash table. | | text | - Text to search for. | | [N] | - If N = 0, number of matches, otherwise the Nth match. (optional) | | [options] | Options. | [M] - (optional) | [@window<notextile>|</notextile>command] | if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. | *Options* table(ktable). |*Option*|*Description*| | <pre> n | - Normal text comparison. (default if M is not specified) | | w | - Text is wildcard text. | | W | - Hash table item/data is wildcard text. | | r | - Text is a regular expression. | | R | - Hash table item/data is a regular expression. | | N | - Use case-sensitive match. *(AdiIRC only)* | | H | - /halt won't halt the running script if used inside the [command]. it will only halt the $hfind's search. *(AdiIRC only)* | </pre> [@window|command] - if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. *Properties* table(ktable). |*Property*|*Description*| | .data | - Search for a matching data value instead of item name. | *Example* <pre> ; Searches hash table 'Example' for all items using and runs the command 'echo -ag $1-' on each result, $1- holds the item name or data. //echo -ag result: $hfind(Example, *, 0, w, echo -ag $1-) ; Searches the hash table 'Example' and prints the number of matches. //echo -ag result: $hfind(Example, *, 0, w) ; Searches the hash table 'Example' and prints the first matched item. //echo -ag result: $hfind(Example, *, 1, w) ; Searches the hash table 'Example' and prints the first matched data. //echo -ag result: $hfind(Example, *, 1, w).data </pre>