protected function pregRegistry(int $id, array $types)
    {
        $registry_types = Utils\Utils::arrayWhitelist(
            self::$cache[$this->config]['registries'],
            $types
        );

        $result = null;
        foreach ($registry_types as $type => $matcher) {
            if (preg_match(
                $matcher['pattern'],
                $this->registries[$id] ?? '',
                $matches
            )) {
                $match = array_combine(
                    $matcher['map'],
                    array_map('trim', array_slice($matches, 1))
                );
                $result = new Registry($this->config, $type, $match);
                break;
            }
        }
        return $result;
    }