getGroup

From RPTools Wiki
Revision as of 20:53, 1 December 2008 by Craig (talk | contribs) (New page: ==Function getGroup== {{ProposedChange}} Returns the specified capture group for the specified match that was found using strfind() ===Usage=== <source lang...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function getGroup

 Note: This refers to a proposed change that has not been implemented in the main code base yet.

Returns the specified capture group for the specified match that was found using strfind()


Usage

[h: text = 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()

Examples

[h: id = strfind("this is a test", "(\\S+)\\s(\\S+)\\s*")]
match 1, group 1 = [getGroup(id, 1, 1)]<br>
match 1, group 2 = [getGroup(id, 1, 2)]<br>
match 2, group 1 = [getGroup(id, 2, 1)]<br>
match 2, group 2 = [getGroup(id, 2, 2)]<br>

Returns

match 1, group 1 = this 
match 1, group 2 = is 
match 2, group 1 = a 
match 2, group 2 = test