Project

General

Profile

$regmlex » History » Version 8

Per Amundsen, 09/20/2020 03:51 AM

1 1 Per Amundsen
_Added in 2.4_
2
3 7 Per Amundsen
*$regmlex([name], M, N, [&binvar])*
4 1 Per Amundsen
5
Returns the Nth [[Scripting_Regex|regular expression]] capture group from the Mth match from [[$regex]], [[$regsub]], [[$regsubex]] or from an [[Scripting_Events|event]].
6
7 6 Per Amundsen
_See also [[$regsubex]], [[$regsub]], [[$regex]], [[$regml]], [[$regerrstr]]._
8 1 Per Amundsen
9
*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
M - If M = 0, number of matches, otherwise the Mth match.
13
N - The Nth group.
14 8 Per Amundsen
[&binvar] - Adds the match to the specified &binvar instead. (changes return value to number of bytes added)
15 1 Per Amundsen
16
*Properties*
17
18
.pos - Returns the match position in the text.
19
.group - Returns the group position (includes empty groups).
20
21
*Example*
22
23
<pre>
24
; Search the text for the pattern 'abcdef' and print the result.
25 2 Per Amundsen
//echo -ag Number of matches: $regex(abcdef,/([a-z])([a-z])/g) - $regmlex(1,1) $regmlex(1,2) $regmlex(2,1) $regmlex(2,2)
26 1 Per Amundsen
</pre>