src/Regex.php
public function capture(Text $text): array {
    preg_match_all($this->raw, (string)$text, $matches, PREG_SET_ORDER);

    foreach($matches as &$match) {
      array_shift($match);

      $match = $text->fromArray($match);
    }

    return $matches;
  }
public function capture(Text $text): array {
    preg_match_all($this->raw, (string)$text, $matches, PREG_SET_ORDER);

    foreach($matches as &$match) {
      array_shift($match);

      $match = $text->fromArray($match);
    }

    return $matches;
  }
Extracts capture groups from a given Text object

@param  Text  $text  The text to capture from

@return  Text[]  An array of new Text objects based on the capturing groups of this regular expression