Project

General

Profile

Actions

$regml » History » Revision 16

« Previous | Revision 16/17 (diff) | Next »
Per Amundsen, 09/20/2020 03:51 AM


Added in 1.9.0

$regml([name], N, [&binvar])

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

Same as $regbr.

See also $regsubex, $regsub, $regex, $regmlex, $regerrstr.

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.
[&binvar] - Adds the match to the specified &binvar instead. (changes return value to number of bytes added)

Properties

.pos - Returns the match position in the text.
.group - Returns the group position (includes empty groups).
.full - Returns the full match. (AdiIRC only)

Example

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

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

Updated by Per Amundsen over 4 years ago · 16 revisions

Also available in: PDF HTML TXT