$hfind » History » Version 4
Per Amundsen, 08/12/2015 09:01 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$hfind(name|N,text,[N],[M],[@window|command])* |
||
4 | |||
5 | Searches table for the Nth item name which matches text and returns the item name. |
||
6 | |||
7 | *Parameters* |
||
8 | |||
9 | name|N - Name of the hash table or the Nth hash table. |
||
10 | text - Text to search for. |
||
11 | [N] - If N = 0, number of matches, otherwise the Nth match. (optional) |
||
12 | [M] - (optional) |
||
13 | <pre> |
||
14 | n - Normal text comparison. (default if M is not specified) |
||
15 | w - Text is wildcard text. |
||
16 | W - Hash table item/data is wildcard text. |
||
17 | r - Text is a regular expression. |
||
18 | R - Hash table item/data is a regular expression. |
||
19 | </pre> |
||
20 | |||
21 | 4 | Per Amundsen | [@window|command] - if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result. |
22 | 1 | Per Amundsen | |
23 | *Properties* |
||
24 | |||
25 | .data - Search for a matching data value instead of item name. |
||
26 | |||
27 | *Example* |
||
28 | |||
29 | <pre> |
||
30 | ; 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. |
||
31 | //echo -ag result: $hfind(Example, *, 0, w, echo -ag $1-) |
||
32 | |||
33 | ; Searches the hash table 'Example' and prints the number of matches. |
||
34 | //echo -ag result: $hfind(Example, *, 0, w) |
||
35 | |||
36 | ; Searches the hash table 'Example' and prints the first matched item. |
||
37 | //echo -ag result: $hfind(Example, *, 1, w) |
||
38 | |||
39 | ; Searches the hash table 'Example' and prints the first matched data. |
||
40 | //echo -ag result: $hfind(Example, *, 1, w).data |
||
41 | </pre> |