Contents

Roo

RegexMatch.name()

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

regexmatch.name(what as Text) as MatchInfo or Nothing

Parameters

  • what. Text. The name of the group that you want info on

Returns

  • If the regex search matched a group named what then this method returns a MatchInfo object
  • If there is no matching named group then Nothing is returned

Example

var r = |(?<forename>\w+)\.(?<surname>\w+)@(?<domain>\w+\.com)|
var t = "pepper.potts@stark.com"
var match = t.match(r).first_match
var domain = match.name("domain")
domain.value # => "stark.com"