Project

General

Profile

Actions

$regbr » History » Revision 1

Revision 1/4 | Next »
Per Amundsen, 08/17/2015 02:14 PM


Added in 1.9.6

$regbr([name], N)

Returns the Nth regular expression match from $regex, $regsub, $regsubex or from an event.

Same as $regml.

Parameters

[name] - A named regular expression, if not defined result from the last regular expression is returned. (optional)
N - If N = 0, number of matches, otherwise the Nth match.

Example

; Search the text for the pattern '(hello)' and print the result.
//echo -ag Number of matches: $regex(Hello World, /(Hello)/) match 1 is: $regbr(1)

; Prefix an event with '$' allows the use of a regular expression in the 'matchtext' field which will fill $regbr with the result.
on $*:TEXT:/Hello/g:*:echo -ag found $regbr(0) matches, first match was $regbr(1)

Updated by Per Amundsen over 9 years ago · 1 revisions

Also available in: PDF HTML TXT