$hmatch » History » Revision 2
Revision 1 (Per Amundsen, 11/22/2015 02:47 PM) → Revision 2/7 (Per Amundsen, 05/24/2018 10:09 AM)
_Added in 2.0_ *$hmatch(name|N,text,[N],[M],[@window|command])* Searches table for the Nth item name which matches text and returns the item name. Uses [[Scripting_Wildcards|wildcard]] wildcard search by default. _See also [[$hfind]]._ *Parameters* 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) [M] - (optional) <pre> n - Normal text comparison. (default if M is not specified) w - Text is [[Scripting_Wildcards|wildcard]] wildcard text. W - Hash table item/data is [[Scripting_Wildcards|wildcard]] wildcard text. r - Text is a egular expression. R - Hash table item/data is a regular expression. </pre> [@window|command] - if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. *Properties* .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: $hmatch(Example, *, 0, w, echo -ag $1-) ; Searches the hash table 'Example' and prints the number of matches. //echo -ag result: $hmatch(Example, *, 0, w) ; Searches the hash table 'Example' and prints the first matched item. //echo -ag result: $hmatch(Example, *, 1, w) ; Searches the hash table 'Example' and prints the first matched data. //echo -ag result: $hmatch(Example, *, 1, w).data </pre>