src/Leevel/Router/OpenApiRouter.php
protected function parseGroupRegex(array $routers): array
    {
        $minCount = $this->computeMinCountVar($routers);

        $regex = [];
        $ruleMap = [];
        $ruleKey = 0;
        $regex[] = '~^(?';

        foreach ($routers as $key => $router) {
            $countVar = $minCount + $ruleKey;
            $emptyMatche = $countVar - count($router['var']);

            $ruleMap[$countVar + 1] = $key;

            $regex[] = '|'.$router['regex'].($emptyMatche ? str_repeat('()', $emptyMatche) : '');

            $ruleKey++;
        }

        $regex[] = ')$~x';

        return [
            implode('', $regex),
            $ruleMap,
        ];
    }
protected function parseGroupRegex(array $routers): array
    {
        $minCount = $this->computeMinCountVar($routers);

        $regex = [];
        $ruleMap = [];
        $ruleKey = 0;
        $regex[] = '~^(?';

        foreach ($routers as $key => $router) {
            $countVar = $minCount + $ruleKey;
            $emptyMatche = $countVar - count($router['var']);

            $ruleMap[$countVar + 1] = $key;

            $regex[] = '|'.$router['regex'].($emptyMatche ? str_repeat('()', $emptyMatche) : '');

            $ruleKey++;
        }

        $regex[] = ')$~x';

        return [
            implode('', $regex),
            $ruleMap,
        ];
    }
解析分组路由正则.

@param array $routers

@return array