Project

General

Profile

$hmatch » History » Version 2

Per Amundsen, 05/24/2018 10:09 AM

1 1 Per Amundsen
_Added in 2.0_
2
3
*$hmatch(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 2 Per Amundsen
Uses [[Scripting_Wildcards|wildcard]] search by default.
8 1 Per Amundsen
9
_See also [[$hfind]]._
10
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
[M] - (optional)
17
<pre>
18
 n - Normal text comparison. (default if M is not specified)
19 2 Per Amundsen
 w - Text is [[Scripting_Wildcards|wildcard]] text.
20
 W - Hash table item/data is [[Scripting_Wildcards|wildcard]] text.
21 1 Per Amundsen
 r - Text is a egular expression.
22
 R - Hash table item/data is a regular expression.
23
</pre>
24
25
[@window|command] - if @window is defined, fills the side-listbox with the results, otherwise the command is run on each result.
26
27
*Properties*
28
29
.data - Search for a matching data value instead of item name.
30
31
*Example*
32
33
<pre>
34
; 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.
35
//echo -ag result: $hmatch(Example, *, 0, w, echo -ag $1-)
36
37
; Searches the hash table 'Example' and prints the number of matches.
38
//echo -ag result: $hmatch(Example, *, 0, w)
39
40
; Searches the hash table 'Example' and prints the first matched item.
41
//echo -ag result: $hmatch(Example, *, 1, w)
42
43
; Searches the hash table 'Example' and prints the first matched data.
44
//echo -ag result: $hmatch(Example, *, 1, w).data
45
</pre>