Contents

Roo

RegexMatch.group()

Returns the MatchInfo object for the specified group number or Nothing if there is no capture group with the specified number.

regexmatch.group(g as Number) as MatchInfo or Nothing

Parameters

  • g. Positive integer Number. The group number that you want information on

Returns

  • If the specified group exists then a MatchInfo object is returned
  • If the specified group does not exist then Nothing is returned
  • If g is negative or g is not a Number then a runtime error is raised

Example

var r = |(\w+)\.(\w+)@(\w+\.com)|
var t = "pepper.potts@stark.com"
var match = t.match(r).first_match
var grp1 = match.group(1)
grp1.value # => "pepper"