Project

General

Profile

$regbr » History » Version 3

Per Amundsen, 07/24/2020 03:10 PM

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