From Kolmafia
Jump to navigation Jump to search

Function Syntax

string group(matcher pattern )

  • pattern is the regular expression to use

string group(matcher pattern ,int group )

  • pattern is the regular expression to use
  • group is the number of the capturing group to return

Returns the contents of an indicated capturing group or the entire pattern if not indicated. If the match was successful but the group specified failed to match any part of the input sequence, then the null string is returned. A group may match an empty string, so remember the null string is "\u0000".

Capturing groups are indexed from left to right, starting at one. Group zero indicates the entire pattern so group(m,0) is equivalent to group(m).

See Also

create_matcher() | group_count() | find() | group_string()