getGroupEnd: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) No edit summary |
|||
Line 1: | Line 1: | ||
= | {{MacroFunction | ||
|name=getGroupEnd | |||
|description=Returns the end index of the specified capture group for the specified match that was found using [[strfind|strfind()]] | |||
|usage= | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: text = getGroupEnd(id, match, group)] | [h: text = getGroupEnd(id, match, group)] | ||
</source> | </source> | ||
Where | Where | ||
* id is the id returned by [[ | * id is the id returned by [[strfind|strfind()]] | ||
* match is the number of the match found by [[ | * match is the number of the match found by [[strfind|strfind()]] | ||
* group is the number of the capture group found by [[ | * group is the number of the capture group found by [[strfind|strfind()]] | ||
|example= | |||
<source lang="mtmacro" line> | <source 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*")] | ||
Line 28: | Line 27: | ||
match 2, group 2 end = 14 | match 2, group 2 end = 14 | ||
</pre> | </pre> | ||
}} | |||
[[Category:String Function]] |
Revision as of 03:14, 7 March 2009
getGroupEnd() Function
Returns the end index of the specified capture group for the specified match that was found using strfind()
Usage
[h: text = 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