/** * @return string * * @throws BuildException */ protected function doSelect() { $this->reg->setPattern($this->pattern); $this->reg->setModifiers($this->modifiers); $this->reg->setIgnoreCase(!$this->caseSensitive); $output = $this->defaultValue; try { if ($this->reg->matches($this->subject)) { $output = $this->reg->getGroup((int) ltrim($this->match, '$')); } } catch (Exception $e) { throw new BuildException($e); } return $output; }