getGroupEnd: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) No edit summary |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=getGroupEnd | |name=getGroupEnd | ||
|version=1.3b48 | |||
|description=Returns the end index of the specified capture group for the specified match that was found using [[strfind|strfind()]] | |description=Returns the end index of the specified capture group for the specified match that was found using [[strfind|strfind()]] | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getGroupEnd(id, match, group) | |||
</ | </syntaxhighlight> | ||
Where | Where | ||
* id is the id returned by [[strfind|strfind()]] | * id is the id returned by [[strfind|strfind()]] | ||
Line 13: | Line 14: | ||
|example= | |example= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: id = strfind("this is a test", "(\\S+)\\s(\\S+)\\s*")] | [h: id = strfind("this is a test", "(\\S+)\\s(\\S+)\\s*")] | ||
match 1, group 1 end = [getGroupEnd(id, 1, 1)]<br> | match 1, group 1 end = [getGroupEnd(id, 1, 1)]<br> | ||
Line 19: | Line 20: | ||
match 2, group 1 end = [getGroupEnd(id, 2, 1)]<br> | match 2, group 1 end = [getGroupEnd(id, 2, 1)]<br> | ||
match 2, group 2 end = [getGroupEnd(id, 2, 2)]<br> | match 2, group 2 end = [getGroupEnd(id, 2, 2)]<br> | ||
</ | </syntaxhighlight> | ||
Returns | Returns | ||
<pre> | <pre> |
Latest revision as of 23:59, 14 March 2023
getGroupEnd() Function
• Introduced in version 1.3b48
Returns the end index of the specified capture group for the specified match that was found using strfind()
Usage
getGroupEnd(id, match, group)
Where
- id is the id returned by strfind()
- match is the number of the match found by strfind()
- group is the number of the capture group found by strfind()
Example
[h: id = strfind("this is a test", "(\\S+)\\s(\\S+)\\s*")]
match 1, group 1 end = [getGroupEnd(id, 1, 1)]<br>
match 1, group 2 end = [getGroupEnd(id, 1, 2)]<br>
match 2, group 1 end = [getGroupEnd(id, 2, 1)]<br>
match 2, group 2 end = [getGroupEnd(id, 2, 2)]<br>
Returns
match 1, group 1 end = 4 match 1, group 2 end = 7 match 2, group 1 end = 9 match 2, group 2 end = 14