$hregex » History » Version 2
Per Amundsen, 01/16/2019 10:05 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 | 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 | //echo -ag result: $hregex(Example, /.*/, 0) |
||
26 | |||
27 | ; Searches the hash table 'Example' and prints the first matched item. |
||
28 | //echo -ag result: $hregex(Example, /.*/, 1) |
||
29 | |||
30 | ; Searches the hash table 'Example' and prints the first matched data. |
||
31 | //echo -ag result: $hregex(Example, /.*/, 1).data |
||
32 | </pre> |