$regmlex » History » Version 3
Per Amundsen, 06/08/2016 02:32 AM
1 | 1 | Per Amundsen | _Added in 2.4_ |
---|---|---|---|
2 | |||
3 | 3 | Per Amundsen | *$regmlex([name], M, N)* |
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 | _See also [[$regml]]._ |
||
8 | |||
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 | |||
15 | *Properties* |
||
16 | |||
17 | .pos - Returns the match position in the text. |
||
18 | .group - Returns the group position (includes empty groups). |
||
19 | |||
20 | *Example* |
||
21 | |||
22 | <pre> |
||
23 | ; Search the text for the pattern 'abcdef' and print the result. |
||
24 | 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) |
25 | 1 | Per Amundsen | </pre> |