preg_match_all

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a global regular expression match
<?php preg_match_all(    string $pattern,    string $subject,    array &$matches = null,    int $flags = 0,    int $offset = 0): int|false
<?php             if (isset(self::$match_cache[$content][$pattern])) {

                $matches = self::$match_cache[$content][$pattern];

            } else {

                preg_match_all($pattern, $content, $matches);

                self::$match_cache[$content][$pattern] = $matches;

            }
<?php     public function find(array $match): string {

        $core = $this->getCore();

        $variable_pattern = self::patternCache($core->getPHPlaterObject(self::CLASS_VARIABLE));

        preg_match_all($variable_pattern, $match['x'], $matches);

        $tag_chain = self::getTag(self::TAG_CHAIN);

        $key_pattern = self::patternCache($core->getPHPlaterObject(self::CLASS_KEY));

        $tag_list = $tag_chain . $tag_chain;
<?php     private static function replaceKeys(string $template, string $key, string $pattern): string {

        if (preg_match_all($pattern, $template, $key_matches) > 0) {

            foreach (array_unique($key_matches[0]) as $key_match) {

                $template = strtr($template, [$key_match => $key]);

            }