private function replaceTokensWithRegexCaptureGroups($regex)
    {
        $tokenRegex = self::TOKEN_REGEX;

        return preg_replace_callback(
            self::PLACEHOLDER_REGEXP,
            array($this, 'replaceTokenWithRegexCaptureGroup'),
            $regex
        );
    }