Project

General

Profile

$regml » History » Version 7

Per Amundsen, 01/16/2019 09:16 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$regml([name], N)*
4
5
Returns the Nth [[Scripting_Regex|regular expression]] match from [[$regex]], [[$regsub]], [[$regsubex]] or from an [[Scripting_Events|event]].
6
7 7 Per Amundsen
_Same as [[$regbr]]._
8 4 Per Amundsen
9 1 Per Amundsen
*Parameters*
10
11
[name] - A named [[Scripting_Regex|regular expression]], if not defined result from the last [[Scripting_Regex|regular expression]] is returned. (optional)
12
N - If N = 0, number of matches, otherwise the Nth match.
13
14 5 Per Amundsen
*Properties*
15
16
.pos - Returns the match position in the text.
17
.group - Returns the group position (includes empty groups).
18
19 1 Per Amundsen
*Example*
20
21
<pre>
22
; Search the text for the pattern '(hello)' and print the result.
23
//echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regml(1)
24
25 3 Per Amundsen
; Prefix an event with '$' allows the use of a regular expression in the 'matchtext' field which will fill $regml with the result.
26 1 Per Amundsen
on $*:TEXT:/Hello/g:*:echo -ag found $regml(0) matches, first match was $regml(1)
27
</pre>