Group string

From Kolmafia
Revision as of 16:41, 5 March 2010 by imported>Jasonharper
Jump to navigation Jump to search



needs(code_samples);

Function Syntax

string [int, int] group_string(string group_me ,string group_by )

  • group_me is the string to split into groups
  • group_by is the regular expression to group by

This function finds all (non-overlapping) matches of the regular expression group_by within the string group_me. A 2-dimensional array of matching strings is returned. The first index is the number of the match, starting with 0 for the first match. The second index is the number of the group within each match, with exactly the same meaning as the 2nd parameter to group(): element 0 is the entire text matched by the regular expression, element 1 is the text matched by the first set of grouping parentheses within the expression, element 2 is the second set of grouping parentheses, and so on.

More Information

See this thread for details.


Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific questions have been raised:

  • The regex isn't too hard to parse, but the results are.
  • For results, I always see [int,0] and [int,1] keys; huh?