Project

General

Profile

$regml » History » Revision 13

Revision 12 (Per Amundsen, 01/13/2020 04:13 AM) → Revision 13/17 (Per Amundsen, 07/24/2020 03:10 PM)

_Added in 1.9.0_ 

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

 Returns the Nth [[Scripting_Regex|regular expression]] match from [[$regex]], [[$regsub]], [[$regsubex]] or from an [[Scripting_Events|event]]. 

 _Same as [[$regbr]]. 

 _See also [[$regsubex]], [[$regsub]], [[$regex]], [[$regmlex]], [[$regerrstr]]._ 

 *Parameters* 

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

 *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* 

 <pre> 
 ; 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) 
 </pre>