src/regular/Match.php
public function getCaptured($i) {
      if ($this->success) {
         if ($i >= 0) {
            $i++; // Captured groups starts from index 1. Index 0 is  the whole match! 
            if (array_key_exists($i, $this->matches)) {
               return new Group($this->matches[$i]);
            } else {
               throw new RuntimeException("The index " . $i . " does not identify any captured subpattern");
            }
         } else {
            throw new RuntimeException("Negative indexes are not allowed");
         }
      } else {
         throw new RuntimeException("The matching was not succesfull");
      }
   }
public function getCaptured($i) {
      if ($this->success) {
         if ($i >= 0) {
            $i++; // Captured groups starts from index 1. Index 0 is  the whole match! 
            if (array_key_exists($i, $this->matches)) {
               return new Group($this->matches[$i]);
            } else {
               throw new RuntimeException("The index " . $i . " does not identify any captured subpattern");
            }
         } else {
            throw new RuntimeException("Negative indexes are not allowed");
         }
      } else {
         throw new RuntimeException("The matching was not succesfull");
      }
   }
public function getCaptured ( $ i ) { if ( $ this -> success ) { if ( $ i >= 0 ) { $ i ++ ; // Captured groups starts from index 1. Index 0 is  the whole match!  if ( array_key_exists ( $ i , $ this -> matches ) ) { return new Group ( $ this -> matches [ $ i ] ) ; } else { throw new RuntimeException ( "The index " . $ i . " does not identify any captured subpattern" ) ; } } else { throw new RuntimeException ( "Negative indexes are not allowed" ) ; } } else { throw new RuntimeException ( "The matching was not succesfull" ) ; } }
Return a captured group.

@param integer $i Index of the wanted captured subgroup
@return Group
@throws RuntimeException
Return a captured group .