コード例 #1
0
ファイル: RegexTask.php プロジェクト: tammyd/phing
 /**
  * @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;
 }
コード例 #2
0
 /**
  * Gets the matched group from the Regexp engine.
  *
  * @param array $matches Matched elements.
  *
  * @return string
  */
 private function replaceReferencesCallback($matches)
 {
     return (string) $this->reg->getGroup($matches[1]);
 }