$regex » History » Version 10
Per Amundsen, 02/23/2023 07:28 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$regex([name], text, re)* |
||
4 | |||
5 | 5 | Per Amundsen | Returns the number of strings in text that matched the [[Scripting_Regex|regular expression]]. |
6 | 1 | Per Amundsen | |
7 | 9 | Per Amundsen | _See also [[$regsubex]], [[$regsub]], [[$regml]], [[$regmlex]], [[$regerrstr]]._ |
8 | 7 | Per Amundsen | |
9 | 1 | Per Amundsen | *Parameters* |
10 | |||
11 | 10 | Per Amundsen | table(ktable). |
12 | |*Parameter*|*Description*| |
||
13 | | [name] | Name of the search, which can later be referenced using [[$regml]]. (optional) | |
||
14 | | text | The text to search. | |
||
15 | | re | The [[Scripting_Regex<notextile>|</notextile>regular expression]] to perform. | |
||
16 | 1 | Per Amundsen | |
17 | *Example* |
||
18 | |||
19 | <pre> |
||
20 | ; Search the text for the pattern '(hello)' and print the result. |
||
21 | 6 | Per Amundsen | //echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regml(1) |
22 | 2 | Per Amundsen | </pre> |