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