Project

General

Profile

$hmatch » History » Version 7

Per Amundsen, 02/23/2023 01:34 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 7 Per Amundsen
table(ktable).
14
|*Parameter*|*Description*|
15
| name<notextile>|</notextile>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 1 Per Amundsen
19
*Properties*
20
21 7 Per Amundsen
table(ktable).
22
|*Property*|*Description*|
23
| .data | Search for a matching data value instead of item name. |
24 1 Per Amundsen
25
*Example*
26
27
<pre>
28
; Searches the hash table 'Example' and prints the number of matches.
29 4 Per Amundsen
//echo -ag result: $hmatch(Example, *, 0)
30 1 Per Amundsen
31
; Searches the hash table 'Example' and prints the first matched item.
32 4 Per Amundsen
//echo -ag result: $hmatch(Example, *, 1)
33 1 Per Amundsen
34
; Searches the hash table 'Example' and prints the first matched data.
35 4 Per Amundsen
//echo -ag result: $hmatch(Example, *, 1).data
36 1 Per Amundsen
</pre>