Project

General

Profile

$regex » History » Version 8

Per Amundsen, 01/16/2019 10:31 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 8 Per Amundsen
_See also [[$regsubex]], [[$regml]], [[$regmlex]], [[$regerrstr]]._
8 7 Per Amundsen
9 1 Per Amundsen
*Parameters*
10
11 3 Per Amundsen
[name] - Name of the search, which can later be referenced using [[$regml]]. (optional)
12 1 Per Amundsen
text - The text to search.
13 4 Per Amundsen
re - The [[Scripting_Regex|regular expression]] to perform.
14 1 Per Amundsen
15
*Example*
16
17
<pre>
18
; Search the text for the pattern '(hello)' and print the result.
19 6 Per Amundsen
//echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regml(1)
20 2 Per Amundsen
</pre>