getGroup: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 33: | Line 33: | ||
</pre> | </pre> | ||
|ExampleSo explained= | |||
First off, normaly you only need one \ in a regex statement, but because MT uses regex itself you need to double escape it, so \\. | First off, normaly you only need one \ in a regex statement, but because MT uses regex itself and the statement is preparsed you need to double escape it, so \\. | ||
*S = 'everything that is NOT a whitespace' | *S = 'everything that is NOT a whitespace' | ||
*s = 'whitespace | *s = 'whitespace |
Revision as of 07:11, 28 September 2012
getGroup() Function
• Introduced in version 1.3b48
Returns the specified capture group for the specified match that was found using strfind()
Usage
getGroup(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 0 = [getGroup(id, 1, 0)]<br>
match 1, group 1 = [getGroup(id, 1, 1)]<br>
match 1, group 2 = [getGroup(id, 1, 2)]<br>
match 2, group 0 = [getGroup(id, 2, 0)]<br>
match 2, group 1 = [getGroup(id, 2, 1)]<br>
match 2, group 2 = [getGroup(id, 2, 2)]<br>
Returns
match 1, group 0 = this is match 1, group 1 = this match 1, group 2 = is match 2, group 0 = a test match 2, group 1 = a match 2, group 2 = test