Project

General

Profile

$hregex » History » Version 3

Per Amundsen, 02/23/2023 01:42 PM

1 1 Per Amundsen
_Added in 3.3_
2
3
*$hregex(name|N,text,[N])*
4
5
Searches table for the Nth item name which matches text using a [[Scripting_Regex|regular expression]] and returns the item name.
6
7
_See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[/hdel]], [[$hget]]._
8
9 2 Per Amundsen
_See also [[$hfind]], [[$hmatch]]._
10 1 Per Amundsen
11
*Parameters*
12
13 3 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 3 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
//echo -ag result: $hregex(Example, /.*/, 0)
30
31
; Searches the hash table 'Example' and prints the first matched item.
32
//echo -ag result: $hregex(Example, /.*/, 1)
33
34
; Searches the hash table 'Example' and prints the first matched data.
35
//echo -ag result: $hregex(Example, /.*/, 1).data
36
</pre>