Project

General

Profile

$regmlex » History » Revision 8

Revision 7 (Per Amundsen, 07/24/2020 03:10 PM) → Revision 8/9 (Per Amundsen, 09/20/2020 03:51 AM)

_Added in 2.4_ 

 *$regmlex([name], M, N, [&binvar])* 

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

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

 *Parameters* 

 [name] - A named [[Scripting_Regex|regular expression]], if not defined result from the last [[Scripting_Regex|regular expression]] is returned. (optional) 
 M - If M = 0, number of matches, otherwise the Mth match. 
 N - The Nth group. 
 [&binvar] - Adds the match to the specified &binvar instead. (changes return value to number of bytes added) *TODO* 

 *Properties* 

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

 *Example* 

 <pre> 
 ; Search the text for the pattern 'abcdef' and print the result. 
 //echo -ag Number of matches: $regex(abcdef,/([a-z])([a-z])/g) - $regmlex(1,1) $regmlex(1,2) $regmlex(2,1) $regmlex(2,2) 
 </pre>