$regmlex » History » Revision 8
« Previous |
Revision 8/9
(diff)
| Next »
Per Amundsen, 09/20/2020 03:51 AM
Added in 2.4
$regmlex([name], M, N, [&binvar])
Returns the Nth regular expression capture group from the Mth match from $regex, $regsub, $regsubex or from an event.
See also $regsubex, $regsub, $regex, $regml, $regerrstr.
Parameters
[name] - A named regular expression, if not defined result from the last 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)
Properties
.pos - Returns the match position in the text.
.group - Returns the group position (includes empty groups).
Example
; 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)
Updated by Per Amundsen over 4 years ago · 8 revisions