$regml » History » Version 8
Per Amundsen, 01/16/2019 09:17 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 | 8 | Per Amundsen | _Same as [[$regbr]]. |
8 | |||
9 | _See also [[$regsubex]], [[$regex]], [[$regmlex]].__ |
||
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 | |||
21 | 1 | Per Amundsen | *Example* |
22 | |||
23 | <pre> |
||
24 | ; Search the text for the pattern '(hello)' and print the result. |
||
25 | //echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regml(1) |
||
26 | |||
27 | 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. |
28 | 1 | Per Amundsen | on $*:TEXT:/Hello/g:*:echo -ag found $regml(0) matches, first match was $regml(1) |
29 | </pre> |