$hmatch » History » Version 6
Per Amundsen, 01/16/2019 10:05 PM
1 | 1 | Per Amundsen | _Added in 2.0_ |
---|---|---|---|
2 | |||
3 | 4 | Per Amundsen | *$hmatch(name|N,text,[N])* |
4 | 1 | Per Amundsen | |
5 | 5 | Per Amundsen | Searches table for the Nth item name which matches text using a [[Scripting_Wildcards|wildcard]] pattern and returns the item name. |
6 | 1 | Per Amundsen | |
7 | 3 | Per Amundsen | _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hget]]._ |
8 | |||
9 | 6 | Per Amundsen | _See also [[$hfind]], [[$hregex]]._ |
10 | 1 | Per Amundsen | |
11 | *Parameters* |
||
12 | |||
13 | name|N - Name of the hash table or the Nth hash table. |
||
14 | text - Text to search for. |
||
15 | [N] - If N = 0, number of matches, otherwise the Nth match. (optional) |
||
16 | |||
17 | *Properties* |
||
18 | |||
19 | .data - Search for a matching data value instead of item name. |
||
20 | |||
21 | *Example* |
||
22 | |||
23 | <pre> |
||
24 | ; Searches the hash table 'Example' and prints the number of matches. |
||
25 | 4 | Per Amundsen | //echo -ag result: $hmatch(Example, *, 0) |
26 | 1 | Per Amundsen | |
27 | ; Searches the hash table 'Example' and prints the first matched item. |
||
28 | 4 | Per Amundsen | //echo -ag result: $hmatch(Example, *, 1) |
29 | 1 | Per Amundsen | |
30 | ; Searches the hash table 'Example' and prints the first matched data. |
||
31 | 4 | Per Amundsen | //echo -ag result: $hmatch(Example, *, 1).data |
32 | 1 | Per Amundsen | </pre> |