Returns a string that replaces a property expression
@param array $matches
@return string
175618
protected function replacePropertyExpression($matches) {
		//count available matches
		//this indicates the type of expression to replace
		$total_matches = count($matches);
		$type = $subindex = null;
	
		switch ($total_matches) {
			/*
			 * Property
			 */
			case 4: //#{PROPERTY@1[INDEX]@2?:TYPE@3}
				$type = substr($matches[3], 1);
			case 3: //#{PROPERTY@1[INDEX]@2}
				$subindex = empty($matches[2]) ? null : substr($matches[2], 1, -1);
			case 2: //#{PROPERTY@1}
				$key = $matches[1];

				//obtain type from annotation (when possible)
				if (is_null($type) && $this->wrappedArg instanceof ObjectArgumentWrapper) {
					if ($this->wrappedArg->getClassProfile()->isEntity()) {
						$property = $this->wrappedArg->getClassProfile()->getProperty($key);
						$type = $property->getType();
					}
				}
	
				return $this->getIndex($key, $subindex, $type);
				break;
	
			/*
			 * Interval
			 */
			case 9: //#{PROPERTY@4[LEFT_INDEX@6..RIGHT_INDEX@7]:TYPE@8}
				$type = substr($matches[8], 1);
			case 8: //#{PROPERTY@4[LEFT_INDEX@6..RIGHT_INDEX@7]}
				$key = $matches[4];
					
				//obtain type from annotation (when possible)
				if (is_null($type) && $this->wrappedArg instanceof ObjectArgumentWrapper) {
					if ($this->wrappedArg->getClassProfile()->isEntity()) {
						$property = $this->wrappedArg->getClassProfile()->getProperty($key);
						$type = $property->getType();
					}
				}
					
				return $this->getRange($key, $matches[6], $matches[7], $type);
				break;
		}
	}
717493
public function buildMatch($match, &$params)
    {
        if (empty($match)) {
            return '';
        }

        if ($match instanceof Expression) {
            return $this->buildMatchValue($match, $params);
        }

        if (!is_array($match)) {
            return $match;
        }

        if (isset($match[0])) {
            // operator format: operator, operand 1, operand 2, ...
            $operator = strtoupper($match[0]);
            if (isset($this->matchBuilders[$operator])) {
                $method = $this->matchBuilders[$operator];
            } else {
                $method = 'buildSimpleMatch';
            }
            array_shift($match);
            return $this->$method($operator, $match, $params);
        }

        // hash format: 'column1' => 'value1', 'column2' => 'value2', ...
        return $this->buildHashMatch($match, $params);
    }
1375062
private function replaceTokenCallback($matches)
    {
        $key = $matches[1];

        /* Get tokens from tokensource and merge them with the
         * tokens given directly via build file. This should be
         * done a bit more elegantly
         */
        if ($this->_alltokens === null) {
            $this->_alltokens = [];

            $count = count($this->_tokensources);
            for ($i = 0; $i < $count; $i++) {
                $source = $this->_tokensources[$i];
                $this->_alltokens = array_merge($this->_alltokens, $source->getTokens());
            }

            $this->_alltokens = array_merge($this->_tokens, $this->_alltokens);
        }

        $tokens = $this->_alltokens;

        $replaceWith = null;
        $count = count($tokens);

        for ($i = 0; $i < $count; $i++) {
            if ($tokens[$i]->getKey() === $key) {
                $replaceWith = $tokens[$i]->getValue();
            }
        }

        if ($replaceWith === null) {
            $replaceWith = $this->_beginToken . $key . $this->_endToken;
            $this->log("No token defined for key \"" . $this->_beginToken . $key . $this->_endToken . "\"");
        } else {
            $this->log(
                "Replaced \"" . $this->_beginToken . $key . $this->_endToken . "\" with \"" . $replaceWith . "\"",
                Project::MSG_VERBOSE
            );
        }

        return $replaceWith;
    }
140718
protected function decodeMatches(array $matches): string
    {
        if (1 === preg_match(static::REGEXP_PREVENTS_DECODING, $matches[0])) {
            return strtoupper($matches[0]);
        }

        return rawurldecode($matches[0]);
    }
520826
private function _typePatternCallback($matches)
	{
		$type = empty($matches[2]) ? 'any' : ltrim($matches[2],':');

		// try basic numeric types
		switch($type)
		{
			case 'any':
				return self::TYPE_ANY;
			case 'int':
			case 'integer':
				return self::TYPE_INTEGER;
			case 'str':
			case 'string':
				return self::TYPE_STRING;
			case 'decimal':
			case 'dec':
				return self::TYPE_DECIMAL;
			case 'greedy':
				return self::TYPE_GREEDY;
		}

		// try the enumeration type
		if(preg_match("#^\(.+?\)$#", $type))
		{
			$items = explode("|",trim($type,"()"));
			$items = array_map('preg_quote', $items);
			return sprintf('(%s)',implode('|',$items));
		}

		// unknown type, fail
		throw new BuildException(
			"Unknown type $type in $this->_template");
	}
1027052
private function findString($i, array $matches)
    {
        $string = isset($matches[0][$i]) ? $matches[0][$i] : '';


        return substr($string, 1, -1);
    }
265071
protected function regexUrl($matches)
    {
        $key = substr($matches[0], 1);
        if (isset($this->conditions[$key])) {
            return '(' . $this->conditions[$key] . ')';
        } else {
            return '(' . self::$conditionRegex['default'] . ')';
        }
    }
1147484
protected function _replaceUrlCallback(array $match)
    {
        $assetPath = str_replace(Router::fullBaseUrl(), '', $match[2]);
        $assetPath = trim(FS::clean($assetPath, '/'), '/');
        $appDir    = trim(FS::clean(APP_ROOT, '/'), '/');

        list ($isPlugin, $assetPath) = $this->_getPlgAssetUrl($assetPath);

        if (!$isPlugin) {
            $assetPath = str_replace($appDir, '', $assetPath);
        }

        $assetPath = str_replace(Configure::read('App.webroot'), '', $assetPath);
        $assetPath = FS::clean($assetPath, '/');

        if ($isPlugin) {
            return $this->_normalizePlgAssetUrl($assetPath);
        }

        return $this->_getAssetUrl($assetPath);
    }
585712
private function _text(array $matches)
    {
        return \Mmi\App\FrontController::getInstance()->getView()->getHelper('text')->text($matches[1]);
    }
393480
protected function normalizeMatches($matches)
    {
        return collect($matches)
            ->filter(function ($item, $key) {
                return ! is_numeric($key);
            })
            ->map(function ($item, $key) {
                $return = $item[0];

                if (starts_with($key, 'load')) {
                    $return = floatval($return);
                } elseif (is_numeric($return)) {
                    $return = (int) $return;
                } elseif (empty($return)) {
                    $return = null;
                }

                return $return;
            })
            ->toArray();
    }
197740
protected function _replaceParamsCallback($matches)
    {
        $key    = substr($matches[0], 1);
        $prefix = '';

        if(in_array($this->show, array('FULL TABLES', 'OPEN TABLES', 'TABLE STATUS', 'TABLES')) &&
            ($this->like && $key == 'like' || $this->where && ($key == 'name' || $key == 'table')))
        {
            $prefix = $this->getDriver()->getTablePrefix();
        }

        $replacement = $this->getDriver()->quoteValue($prefix.$this->_parameters[$key]);

        return is_array($this->_parameters[$key]) ? '('.$replacement.')' : $replacement;
    }
982120
public function compile($matches)
    {
        $expression = $this->compiler->stringDotsToArrayKeys($matches[2]);

        if (in_array($statement = $matches[1], ['isset', 'empty'])) { // {isset: $var} shortcuts
            $variable = "if({$statement}({$expression})):";
        } else {
            $variable = "{$statement}({$expression}):";
        }

        if ($statement == "foreach") {
            
        }

        return $this->compiler->wrap($variable, null);
    }
211715
private function replaceNumberedHolder(array $matches)
    {
        $holder = ':numbered_holder_' . $this->count_numbered;
        $this->count_numbered ++;
        return (isset($matches[1]) ? $matches[1] : '') . $holder . (isset($matches[2]) ? $matches[2] : '');
    }
1332912
public function convertLinkName(array $matches)
    {
        $replacedEmail = $this->linkNameConverter->convert(trim($matches[2]));

        return $matches[1] . $replacedEmail;
    }
1093507
public function compile($matches)
    {
        if ($matches[1] == '$') {
            $matches[2] = '$' . $matches[2];
        }

        $variable = $this->compileTernaryOperators($this->compiler->stringDotsToArrayKeys($matches[2]));

        $whitespace = empty($matches[4]) ? '' : $matches[4] . $matches[4];

        if (! empty($matches[3])) {
            $function = $matches[3];

            if (strpos($function, ":") !== false) {
                list($function, $args) = explode(":", $function, 2);

                $function .= "({$variable},{$args}";
            } else {
                $function .= "({$variable}";
            }

            $function .= ")";

            $variable = $function;
        }

        return $this->compiler->wrap("echo tplEscape({$variable})") . $whitespace;
    }
401997
private function replaceId($matches)
    {
        $match = $matches[0];
        $id = "##r" . uniqid() . "##";

        // String or Comment?
        if (substr($match, 0, 2) == '//' || substr($match, 0, 2) == '/*' || substr($match, 0, 2) == '##' || substr($match, 0, 7) == '&lt;!--') {
            $this->tokens[$id] = '<span class="exception-comment">' . $match . '</span>'; // #7F9F7F
        } else {
            $this->tokens[$id] = '<span class="exception-string">' . $match . '</span>'; // #CC9385
        }
        return $id;
    }
1328454
private function substituteFilter($matches)
    {
        if (isset($matches[1]) && isset($this->filters[$matches[1]])) {
            return $this->filters[$matches[1]];
        }
        return "([/][\w-\._@%]*)";
    }