Project

General

Profile

$regml » History » Version 12

Per Amundsen, 01/13/2020 04:13 AM

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 8 Per Amundsen
_Same as [[$regbr]].
8
9 11 Per Amundsen
_See also [[$regsubex]], [[$regsub]], [[$regex]], [[$regmlex]], [[$regerrstr]]._
10 4 Per Amundsen
11 1 Per Amundsen
*Parameters*
12
13
[name] - A named [[Scripting_Regex|regular expression]], if not defined result from the last [[Scripting_Regex|regular expression]] is returned. (optional)
14
N - If N = 0, number of matches, otherwise the Nth match.
15
16 5 Per Amundsen
*Properties*
17
18
.pos - Returns the match position in the text.
19
.group - Returns the group position (includes empty groups).
20 12 Per Amundsen
.full - Returns the full match. *(AdiIRC only)*
21 5 Per Amundsen
22 1 Per Amundsen
*Example*
23
24
<pre>
25
; Search the text for the pattern '(hello)' and print the result.
26
//echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regml(1)
27
28 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.
29 1 Per Amundsen
on $*:TEXT:/Hello/g:*:echo -ag found $regml(0) matches, first match was $regml(1)
30
</pre>